Skip to content

Instantly share code, notes, and snippets.

@chasereeves
Created January 31, 2012 00:57
Show Gist options
  • Save chasereeves/1707930 to your computer and use it in GitHub Desktop.
Save chasereeves/1707930 to your computer and use it in GitHub Desktop.
Wordpress test for whether current page is parent or child
function is_has_child() {
global $post;
if ( is_page() && $post->post_parent )
return true;
$children = get_pages('child_of='.$post->ID);
if( count( $children ) != 0 )
return true;
else
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment