Want to be able to use one condition which includes or excludes pages based on weather they are children of a specific page?
Add this code to functions.php:
function is_kid( $pid,$includeparent = 0 ) { // $pid = The ID of the page we're looking for pages underneath
//$includeparent = 1 to include the parent page, 0 to exclude
global $post; // load details about this page
if ( is_page($pid) )
return $includeparent; // we're at the page
$anc = get_post_ancestors( $post->ID );
foreach ( $anc as $ancestor ) {
if( is_page() && $ancestor == $pid ) {
return true;
}
}
return false; // we aren't at the page, and the page is not an ancestor
}then use this in your page template:
if (is_kid($page_id,1)) //1 to include the parent page, 0 to exclude
{
code here
}