Guest User

Untitled

a guest
Mar 21st, 2012
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. <?php
  2. // use wp_list_pages to display parent and all child pages all generations (a tree with parent)
  3. $parent = $post->ID;
  4. $args=array(
  5. 'child_of' => $parent
  6. );
  7. $pages = get_pages($args);
  8. if ($pages) {
  9. $pageids = array();
  10. foreach ($pages as $page) {
  11. $pageids[]= $page->ID;
  12. }
  13.  
  14. $args=array(
  15. 'include' => $parent . ',' . implode(",", $pageids)
  16. );
  17. wp_list_pages($args);
  18. }
  19. ?>
Add Comment
Please, Sign In to add comment