Add pagination to list of child pages
-
Hello,
I have a page where I’m pulling a list of child page titles/excerpts for that particular page. There are around 30 child pages for this particular page so I just want to display 10 child page titles/excerpts at a time with “Previous” and “Next” navigation buttons at the bottom of the page. The code listed below works fine but displays ALL of the child pages. Any Assistance is greatly appreciated.
Thanks
<!– Start Code –>
<?php
$pageChildren = get_pages(‘child_of=’ . $post->ID . ‘&exclude=’ . $exclude_page );
if ( $pageChildren ) {
foreach ( $pageChildren as $pageChild ) {
$pageChild->post_title.'</h2>’;query_posts(‘page_id=’ . $pageChild->ID);
if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class=”post” id=”post-<?php the_ID(); ?>”>
<h2><?php the_title(); ?></h2>
<div class=”entry”>
<?php the_excerpt(‘<p class=”serif”>Read the rest of this page »</p>’); ?><?php wp_link_pages(array(‘before’ => ‘<p>Pages: ‘, ‘after’ => ‘</p>’, ‘next_or_number’ => ‘number’)); ?>
</div>
</div>
<?php endwhile; endif; ?><?php
}
}
?>
<!– End Code –>
- The topic ‘Add pagination to list of child pages’ is closed to new replies.