Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.