When you want to display all the child pages title and excerpt of current parent page then you can display by adding following code in your page template file
<?php
$child_pages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_parent = ".$post->ID." AND post_type = 'page' ORDER BY menu_order", 'OBJECT'); ?>
<?php if ( $child_pages ) : foreach ( $child_pages as $pageChild ) : setup_postdata( $pageChild ); ?>
<h2 class="subpagetitle"><a href="<?php echo $pageChild->guid; ?>" rel="bookmark" title="<?php echo $pageChild->post_title; ?>"><?php echo $pageChild->post_title; ?></a></h2>
<?php the_excerpt();?>
<?php endforeach; endif;
?>
If you don’t want to display child pages on every page then you can use Wordpress Conditional Tags.








January 14th, 2009













Leave a Comment