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

$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  get_permalink($pageChild->ID); ?>" rel="bookmark" title="<?php echo $pageChild->post_title; ?>"><?php echo $pageChild->post_title; ?></a></h2>
<?php/* And if you want to get the custom field values then you can get that by */
$your_custom_field = get_post_meta($pageChild->ID, 'your_custom_field', $single = true);
<?php endforeach; endif; ?>

If you don’t want to display child pages on every page then you can use WordPress Conditional Tags.

Leave a Reply

Your email address will not be published. Required fields are marked *