September 7th, 2010 by

That’s the question. You can find out if a page has child pages with this if – else statement:

if ($post->post_parent) { // is this page a parent? / does this page have children?
    echo "this post is a parent of these pages: " . wp_list_pages( 'child_of=' . $post->post_parent . '&title_li=' );
  } else {
 echo "this page has no descendants."
}

Leave a Reply