Created
May 14, 2012 10:18
-
-
Save bolstad/2693110 to your computer and use it in GitHub Desktop.
Does the current page got any children?
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
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