WordPress.org

Make WordPress Core

Opened 9 years ago

Closed 7 years ago

#4531 closed enhancement (fixed)

Add limit parameter to get_pages

Reported by: DD32 Owned by: westi
Milestone: 2.8 Priority: normal
Severity: minor Version:
Component: Template Keywords: has-patch tested commit
Focuses: Cc:

Description

add 'numberposts' and 'offset' to get_pages() to allow for limiting of returned posts.

Attachments (3)

4531.get_pages-limits (914 bytes) - added by DD32 9 years ago.
Adds numberpages and offset to get_pages
4531-add-limit-parameters-to-get_pages.diff (846 bytes) - added by Speedboxer 9 years ago.
Add offset and number parameters to get_pages()
4531-number-offset-get_pages.diff (917 bytes) - added by Speedboxer 7 years ago.
Updated patch

Download all attachments as: .zip

Change History (18)

@DD32
9 years ago

Adds numberpages and offset to get_pages

#1 @DD32
9 years ago

'Doh!
Sorry, I meant "adds 'numberpages'" in the Description :)

#2 @Speedboxer
9 years ago

  • Component changed from Administration to Template
  • Keywords get_pages has-patch added

#3 @Speedboxer
9 years ago

  • Keywords changed from get_pages, has-patch to get_pages has-patch

#4 follow-up: @rob1n
9 years ago

Why is it 'numberposts'? Why not 'numberpages'?

#5 in reply to: ↑ 4 ; follow-up: @foolswisdom
9 years ago

Replying to rob1n:

Why is it 'numberposts'? Why not 'numberpages'?

DD32 commented on wp-hackers about that typo that is in the ticket, but not in the patch.

#6 @ryan
9 years ago

I think we use "number" in other places. Let's keep it consistent.

The number needs to be cast to an int for security. See how number is used in get_terms().

@Speedboxer
9 years ago

Add offset and number parameters to get_pages()

#7 @Speedboxer
9 years ago

  • Keywords needs-testing added

Patch 4531-add-limit-parameters-to-get_pages.diff adds offset and number parameters to get_pages().

#8 in reply to: ↑ 5 @DD32
9 years ago

Replying to foolswisdom:

Replying to rob1n:

Why is it 'numberposts'? Why not 'numberpages'?

DD32 commented on wp-hackers about that typo that is in the ticket, but not in the patch.

See comment 1:

DD32:

'Doh! Sorry, I meant "adds 'numberpages'" in the Description :)

If we want to standarise on 'number' and 'offset' for all functions, then it might be an idea to depreciate "numberposts" in get_posts too:

function get_posts($args) {
	global $wpdb;

	$defaults = array(
		'numberposts' => 5, 'offset' => 0, 

#9 @ryan
8 years ago

  • Milestone changed from 2.3 to 2.4

#10 @westi
8 years ago

  • Milestone changed from 2.5 to 2.6
  • Owner changed from anonymous to westi
  • Status changed from new to assigned
  • Type changed from defect to enhancement

marking as an enhancement

moving to 2.6 for resolving.

Fix with #4711

#11 follow-up: @Denis-de-Bernardy
7 years ago

still current?

@Speedboxer
7 years ago

Updated patch

#12 in reply to: ↑ 11 @Speedboxer
7 years ago

Replying to Denis-de-Bernardy:

still current?

It probably is, updated my patch.

#13 @Denis-de-Bernardy
7 years ago

  • Keywords tested commit added; get_pages needs-testing removed
  • Milestone changed from 2.9 to 2.8

patch is harmless

#14 @Denis-de-Bernardy
7 years ago

I *am* wondering how this is useful, though. :D

#15 @westi
7 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In [11251] - Add paging support to get_pages(). Fixes #4531 props DD32.

Note: See TracTickets for help on using tickets.