Skip to content

Instantly share code, notes, and snippets.

@bolstad
Created May 14, 2012 10:18
Show Gist options
  • Save bolstad/2693110 to your computer and use it in GitHub Desktop.
Save bolstad/2693110 to your computer and use it in GitHub Desktop.
Does the current page got any children?
if (!function_exists('hip_has_children'))
{
function hip_has_children($child_of = null)
{
// original code based on http://forrst.com/posts/WordPress_has_children_function-DmS
$posttype = get_post_type($child_of);
if(is_null($child_of)) {
global $post;
$child_of = ($post->post_parent != '0') ? $post->post_parent : $post->ID;
}
return (wp_list_pages("child_of=$child_of&post_type=$posttype&echo=0")) ? true : false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment