You can get an array of child pages using get_children. Use the parent page’s ID as post_parent
.
Once you have the array, you can loop through them and display whatever info you want. For example, to show the page title (linked) and the excerpt you could do:
$args = array(
'post_parent' => $post -> ID
);
$children = get_children( $args );
if( $children ):
foreach( $children as $child ):
$permalink = get_permalink( $child -> ID );
echo '<a href="' . $permalink . '">' . $child -> post_title . '</a>';
echo $child -> post_excerpt
endforeach;
endif;
You mentioned using the read more link – that’s actually added to the post content, not the excerpt.
How to use ‘Read More’ – create a loop
Get the children as above but create a loop from the results. Using the_content()
will show the truncated content where you have added a ‘Read More’ marker. Do this instead of the if
statement above.
foreach ( $children as $child ) : setup_postdata( $child );
the_content();
endforeach;
wp_reset_postdata();
You can see more examples on the get_posts page