Posted By

cyberhobo on 08/17/09


Tagged

template post page wordpress children wordpress-template has-children


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

irishsk
umang_nine
maxvee8
YA


Wordpress: Does a page have children?


 / Published in: PHP
 

URL: http://codex.wordpress.org/Function%5FReference/get%5Fchildren

There's no has_children() function in WP 2.8.4, but get_children() returns false if the post/page has no children, so it can serve the same purpose in a page template.

Outside a page template you'd have to add a global declaration for the $post variable.

  1. if ( get_children( $post->ID ) ) {
  2. // ...
  3. }

Report this snippet  

You need to login to post a comment.