wp_list_page with something like showpost

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).

Read More

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???

Related posts

Leave a Reply

1 comment