get_pages how to disable grandchildren
-
Hi guys
im using this code to display child pages of current page
with their content…<?php $mypages = get_pages('child_of='.$post->ID.'&sort_column=post_date&sort_order=asc'); $count = 0; $numberofsub = count(get_pages('depth=1&child_of='.$post->ID)); foreach($mypages as $page) { $content = $page->post_content; if($count == $numberofsub) break; $count++; ?> <h2><a href="<?php echo get_page_link($page->ID) ?>"><?php echo $page->post_title ?></a></h2> <div class="entry"><?php echo $content ?></div> <?php } ?>
The problem is , it display grandchildren too..
How can I exclude grandchildren from being displayed ?
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘get_pages how to disable grandchildren’ is closed to new replies.