Advertisement
lberelson

custom3 - function child or no child_FINAL

Jan 29th, 2014
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.31 KB | None | 0 0
  1.  //test for child pages used in main loop
  2. function testchildren () {
  3.    global $post;
  4.     $childtest = get_pages('child_of='.$post->ID); //$children or $myvar
  5.     if( count( $childtest ) != 0 )  {
  6.         /* echo 'has NO children'; */
  7.         return false;
  8.         }
  9.     else
  10.         {
  11.         /* echo 'has children'; */
  12.         return true;
  13.         }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement