Skip to content

Instantly share code, notes, and snippets.

@beovulf
Created February 3, 2016 07:59
Show Gist options
  • Save beovulf/244ff7ef4096b6c813d1 to your computer and use it in GitHub Desktop.
Save beovulf/244ff7ef4096b6c813d1 to your computer and use it in GitHub Desktop.
Loop direct children
<?php $q = new WP_Query( array( 'post_type' => 'page', 'post_parent' => 97, 'depth' => 1 ) );
if ( $q->have_posts() ) : while ( $q->have_posts() ) : $q->the_post();
?>
<?php endwhile; endif;?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment