parent page and child page code example
Example: wordpress grand child list page names
<?php
$mypages = get_pages( array(
'child_of' => $post->ID,
'sort_column' => 'menu_order',
'parent' => $post->ID ) );
foreach( $mypages as $page ) {
$mycontent = $page->post_content;
$mycontent = apply_filters( 'the_content', $mycontent );
?>
<?php
$childArgs = array(
'sort_order' => 'ASC',
'sort_column' => 'menu_order',
'child_of' => $page->ID
);
$childList = get_pages($childArgs);
foreach ($childList as $child) { ?>
<div class="grandchild-page">
<h2><a href="<?php echo get_page_link( $child->ID ); ?>"><?php echo $child->post_title; ?></a></h2>
</div>
<?php } ?>
<?php } ?>
<?php endwhile;
endif; ?>