Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm using this code

    <?php
        $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0');
        $subpages = ($post->post_parent) ? wp_list_pages('title_li=&child_of='.$post->post_parent.'&echo=0') : wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0') ; 
            if ($children) { ?>
               <li><?php echo $children; ?></li>
            <?php } else { ?>
               <?php echo $subpages; ?> 
    <?php } ?>

This code display child pages on a parent page, also if there are not childs it will display the child of the parent (brothers).

However I need to restrict it to display only 5 pages, something like showpost=5 for post, I havent been able to do it, any help???

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Just pass number=5 and it should work since wp_list_pages() uses get_pages() which has number parameter, and also if you look at wp_list_pages codex entry at the bottom under change log you can see that it take the number parameter since version 2.8

share|improve this answer
    
worked great! thx a lot! –  andresmijares25 Oct 13 '11 at 3:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.