// ECHO SUB-NAV function echo_sub_nav($postID,$forceCurrent=false){ if($forceCurrent){ echo ''; } if(is_subpage($postID)){ $tempPost = get_post($postID); $subPages = wp_list_pages('title_li=&echo=0&child_of='.$tempPost->post_parent); }else{ $subPages = wp_list_pages('title_li=&echo=0&child_of='.$postID); } if(!empty($subPages)){ ?> post_parent ) || $post->post_parent <= 0 ) return false; // is there something to check against? if ( ! isset( $page ) ) { // yup this is a sub-page return true; } else { // if $page is an integer then its a simple check if ( is_int( $page ) ) { // check if ( $post->post_parent == $page ) return true; } else if ( is_string( $page ) ) { // get ancestors $parent = get_ancestors( $post->ID, 'page' ); // does it have ancestors? if ( empty( $parent ) ) return false; // get the first ancestor $parent = get_post( $parent[0] ); // compare the post_name if ( $parent->post_name == $page ) return true; } return false; } }