Return to Snippet

Revision: 69493
at June 30, 2015 16:22 by hussong


Initial Code
<div class="entry-content entry">

					<?php the_content(); ?>

				</div><!-- .entry-content -->

				<!-- list child-pages with links and excerpt -->
				<?php global $post; ?>
				<?php $pages = get_pages( array( 'child_of' => $post->ID,  'orderby' => 'menu_order' ) ); ?>
				<?php if ( $pages ) : ?>
  	        <?php $inner_query = new WP_Query("post_type=page&posts_per_page=-1&post_parent={$id}&orderby=menu_order&order=ASC");
                while ($inner_query->have_posts()) : $inner_query->the_post(); ?>
	                    <h2 class="children-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
	                    <?php the_excerpt(); ?>

		        <?php endwhile; endif; ?>

		        <?php wp_reset_query(); ?>

Initial URL

                                

Initial Description
Snippet for a parent page to list child pages with excerpts.

Initial Title
WordPress Parent Page with Child Page Excerpts

Initial Tags
template, wordpress

Initial Language
PHP