Skip to content

Instantly share code, notes, and snippets.

@braddalton
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save braddalton/0ee341e603e946a269b7 to your computer and use it in GitHub Desktop.
Save braddalton/0ee341e603e946a269b7 to your computer and use it in GitHub Desktop.
$args = array(
'post_parent' => $post->ID,
'post_type' => 'page'
);
$child_query = new WP_Query( $args );
if ( $child_query->have_posts() ) {
echo '<ul>';
while ( $child_query->have_posts() ) {
$child_query->the_post();
echo '<li>' . get_the_title() . '</li>';
}
echo '</ul>';
} else {
// no posts found
}
wp_reset_postdata();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment