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.