Hi -- I have a page template that shows a list of sub-pages for a given parent page. I'd like it to show an excerpt or a preview of each sub-page listed.
Looking at the docs for wp_list_pages - it doesn't look like there's an argument for it.
Is there a way to do this or maybe a plug-in that anyone knows about?
Thanks!
- Chris
You'll have to use the template tag, query_posts(), with parameters like 'post_type=page&post_parent=47' in your page template and then use the_excerpt() in your loop.
Assuming your page parent id is 47, here's an example loop:
<?php $page_query = new WP_Query('post_type=page&post_parent=47'); ?>
<?php while ($page_query->have_posts()) : $page_query->the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a>
<?php the_content('Read the rest of this entry »'); ?>
<?php endwhile; ?>
Didn't Mushu say WP wasn't made for this ;)
Thanks, this is exactly what I've been looking for, but in a "if child pages then show else do nothing" fashion. Will post code once I get it to work.
Exactly what I was looking for -- thanks!