/ Published in: PHP

Snippet for a parent page to list child pages with excerpts.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<div class="entry-content entry"> <?php the_content(); ?> </div><!-- .entry-content --> <!-- list child-pages with links and excerpt --> <?php global $post; ?> <?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(); ?>
Comments
