Advertisement
Guest User

Ola

a guest
Mar 29th, 2012
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.61 KB | None | 0 0
  1. echo "<pre>";
  2. /* Trying to get this page ID */
  3. function getPageID(){
  4.     if(have_posts()) {
  5.         while(have_posts()) {
  6.             the_post();
  7.             $portfolio_page_id = get_the_ID();
  8.         }
  9.     }
  10.     return $portfolio_page_id;
  11. }
  12.  
  13. /* Get all subpages for the given page ID */
  14. function getSubPages($thisPageID){
  15.     $my_wp_query = new WP_Query();
  16.     $pages_to_get = array(
  17.         'post_type' => 'page',
  18.         'order' => 'ASC',
  19.         'orderby' => 'menu_order'
  20.     );
  21.     $all_wp_pages = $my_wp_query->query($pages_to_get);
  22.     return get_page_children($thisPageID, $all_wp_pages );
  23. }
  24.  
  25. $children = getSubPages(getPageID());
  26. print_r($children);
  27. echo "</pre>";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement