Created
January 31, 2012 00:57
-
-
Save chasereeves/1707930 to your computer and use it in GitHub Desktop.
Wordpress test for whether current page is parent or child
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
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