lmartins
11/11/2014 - 12:30 PM

Checks if current page has subpages

Checks if current page has subpages

function has_children() {
    global $post;

    $children = get_pages( array( 'child_of' => $post->ID ) );
    if( count( $children ) == 0 ) {
        return false;
    } else {
        return true;
    }
}