function has_children() {
global $post;
$children = get_pages( array( 'child_of' => $post->ID ) );
if( count( $children ) == 0 ) {
return false;
} else {
return true;
}
}
function has_children()
{
return (bool)get_pages(array(
'child_of' => get_the_ID(),
'number' => 1
));
}