child_of gets all subpages
-
Hello,
I’m using the following code in a table cell to show a list of page excerpts
<?php $pages = get_pages('child_of='.$post->ID.'&sort_column=post_date&sort_order=asc'); $count = 0; foreach($pages as $page) { $excerpt = $page->post_excerpt; if(!$excerpt) continue; $excerpt = apply_filters('the_excerpt', $excerpt); ?> <a href="<?php echo get_page_link($page->ID) ?>"><?php echo $excerpt ?></a> <?php } ?>
but rather than just show the subpages of the current page, it will show all subpages.
At the moment it works and only shows direct descendants if I hard code in the page ID, but I’d like to make this a template I can implement onto other pages without having to edit the code each time.
Any ideas?
Cheers
Anthony
Viewing 10 replies - 1 through 10 (of 10 total)
Viewing 10 replies - 1 through 10 (of 10 total)
- The topic ‘child_of gets all subpages’ is closed to new replies.