function has_children($post_id) {

$pages = get_pages('child_of=' . $post_id);

return count($pages);
}

Advertisements