New answers tagged children
Before reading the solution Bravokeyl provided I had finally, through trial and error, come up with a solution that worked for me. I'm not sure which is the better of the two, or the most correct, I only know that mine worked for me, for the problem I had. This is the code I used to display full-width layout or sidebar-menu layout: if( is_page() ...
Level-0 --Level-1 ----Level-2 ------Level-3 ----Levelanother-2 --Levelanother-1 check whether page is top level page (it may have children or not) ? $post->$post_parent == 0 or is empty get_post_ancestors( $post ) returns only Level-0 Pages. Is a child page and is a Level-1 page or Levelanother-1 only ? $post->$post_parent > 0 or is not empty ...
Also you can use 'include_children' => false, instead. See explanation from the Codex: include_children (boolean) - Whether or not to include children for hierarchical taxonomies. Defaults to true. Link - http://codex.wordpress.org/Class_Reference/WP_Query
Top 50 recent answers are included