親ページA
├子ページA
├子ページB
└子ページC
親ページAに子ページA~Bのタイトルと本文を表示したい場合、親ページA(page.php)に下記コードを記入。
<?php
$child_posts = get_posts( 'numberposts=-1&order=ASC&orderby=post_title&post_type=page&post_parent=' . $post->ID );
if ( $child_posts ) {
foreach ( $child_posts as $child ) {
$c_title = apply_filters( 'the_title', $child->post_title );
$c_content = get_extended( $child->post_content );
$c_content = apply_filters( 'the_content', $c_content['main'] );
?>
<h3><?php echo $c_title; ?></h3>
<div class="entry">
<?php echo $c_content; ?>
</div>
<?php
}
}
?>
–制作メモ



