Created
May 7, 2013 23:04
-
-
Save brianfryer/5536893 to your computer and use it in GitHub Desktop.
A snippet to display child pages of the current page for WordPress.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( have_posts() ) while ( have_posts() ) : the_post(); | |
endwhile; | |
$childArgs = array( | |
'post_parent' => $post->ID, | |
'post_type' => 'page', | |
'posts_per_page' => '-1', | |
'orderby' => 'menu_order', | |
'order' => 'ASC' | |
); | |
$child = new WP_Query($childArgs); | |
if ($child->have_posts()) : while ($child->have_posts()) : $child->the_post(); | |
?> | |
<section class="hero"> | |
<h2><?php the_title(); ?></h2> | |
<?php the_content(); ?> | |
</section> | |
<?php endwhile; endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment