Posted By

larscmagnusson on 07/18/13


Tagged

wordpress wp single Parent subpage getpost


Versions (?)

get page or parent page id


 / Published in: PHP
 

  1.  
  2. #### Submeny, användare WordPress wp_nav_menu Filter
  3. function get_page_or_parent_page_id(){
  4. global $post;
  5.  
  6. if($post->post_parent)
  7. return $post->post_parent;
  8. else
  9. return $post->ID;
  10. }
  11. function has_subpages(){
  12. return strlen(wp_list_pages(array("child_of"=>get_page_or_parent_page_id(), "echo" => false))) > 0;
  13. }

Report this snippet  

You need to login to post a comment.