Created
July 8, 2013 21:49
-
-
Save xafarali/5952787 to your computer and use it in GitHub Desktop.
Check all set of child page for given page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ----------------------------------------------------- | |
* Page - Checks child subset to enable widget in sidebar | |
-------------------------------------------------- */ | |
function has_page_child_set( $page_check ) { | |
global $post; | |
//global $page_check; | |
//$page_check = $name; | |
//if( !empty( get_page($page_check)) ) return; | |
$page_ID = get_ID_by_slug ($page_check); | |
if ($page_ID ){ | |
$children = get_pages('child_of='.$page_ID); | |
$page_list[] = $page_ID; | |
foreach ($children as $child) { | |
$page_list[] = $child->ID; | |
} | |
return $page_list; | |
} else { | |
$page_list[]=""; | |
return $page_list; | |
} | |
} // page_child_set() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment