Skip to content

Instantly share code, notes, and snippets.

@carlynorama
Created November 17, 2011 21:55
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 carlynorama/1374671 to your computer and use it in GitHub Desktop.
Save carlynorama/1374671 to your computer and use it in GitHub Desktop.
Wordpress: Show Child Pages
<?php
/**
* Show Child Pages
* Works, no formating
* Must come after <?php the_post(); ?>
*/
$myID = $post->ID;
$highlighted_args = array(
'post_parent' => $myID,
'post_type' => 'page',
'post_status' => 'publish',
'posts_per_page' => 3,
'no_found_rows' => true,
);
// The Featured Posts query.
$higlighted = new WP_Query( $highlighted_args );
if ( $higlighted->have_posts() ) :
?>
<div class="higlighted-posts">
<!--<h1 class="showcase-heading"><?php _e( 'Child Pages', 'twentyeleven' ); ?></h1> -->
<?php
// Let's roll.
while ( $higlighted->have_posts() ) :
$higlighted->the_post();
?>
<?php the_content(); ?>
<?php endwhile; ?>
</div><!-- .highlighted-posts -->
<?php endif; // if ( $higlighted->have_posts() ) ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment