Skip to content

Instantly share code, notes, and snippets.

@xafarali
Created July 8, 2013 21:49
Show Gist options
  • Save xafarali/5952787 to your computer and use it in GitHub Desktop.
Save xafarali/5952787 to your computer and use it in GitHub Desktop.
Check all set of child page for given page
/* -----------------------------------------------------
* 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