Posted By

awesomewordpressthemes on 11/04/10


Tagged

wordpress


Versions (?)

Check if current page has subpage


 / Published in: PHP
 

URL: http://awesomewordpressthemes.net/wordpress-tips/check-current-page-subpage/

You may want to create navigation where the children are displayed only when the parent page is the current page. Place the code in your functions.php file

  1. function hasChildpage() {
  2. $page = wp_list_pages('depth=1&child_of=' . $post->ID . '&echo=0');
  3.  
  4. if($page) {
  5. return true;
  6. } else {
  7. return false;
  8. }
  9. }

Report this snippet  

You need to login to post a comment.