You can try modifying the function in WP itself to do this.
In wp-includes/template-functions-post.php, go to the function get_pages
(around line 260). In the function, look for $pages, and in this the line:
"ORDER BY " . $r['sort_column'] . " " . $r['sort_order']);
"ORDER BY " . $r['sort_column'] . " " . $r['sort_order'] . " LIMIT 15");
When making changes to the core files, backup any files you are editing, and comment your changes.
Note this may or may not work (I kept get errors using a LIMIT less than 3, which related to the _page_level_out
function and the parent/child relationships with Pages).
What is the WP file that I would open?
What is it’s name and where is it located?
Here:
wp-includes/template-functions-post.php
I’m in a similar predicament, but I’d only like to limit the numbers of *some* wp_list_pages routines.
Basically, on my sidebar template, I would like WP to list the 3 most recently-created pages under a certain hierarchy (in this case, child of page 12). The code I currently use that lists an unlimited number of recently-created pages (that are a child of page 12) is:
<dd><?php wp_list_pages('child_of=12&sort_column=post_date&title_li='); ?></dd>
This works very well. But… I would like to return only three pages in this list (presumably the three most-recently created). I don’t want to mess with the template-functions-post.php file, as David did, because there are other places on my site where I would want to list more than 3 pages at a time (e.g., the full page hierarchy).
I noticed that there is a new (1.5.1 and newer) function to wp_list_pages called “echo.”
It is described as “echo: 1.5.1+ – Display the Page links list (1 – true) or return the list to be used in PHP (0 – false). Defaults to 1.”
Essentially, if I’m reading this right, it allows me to decide whether to display the list (default) or not (0, or false).
Once I have echoed this list, is there any php I can use to then display only the first three lines of this list?
I would appreciate any input.
I did this:
http://wordpress.org/support/topic/29079#post-163751
and my pages on my sidebar are listing every post. How to I limit them?
I found that it works, but it will only go up to 15