run wp_list_pages only when current page has children
-
I’m a newbie: apologies for going over old ground (if that’s what I’m doing) ??
I’ve got some code in sidebar.php. Goes like this:
global $id; // the page id
wp_list_pages('child_of=' . $id . '&title_li=<h2>' . __('In This Section') . '</h2>' ); ?>
Great, sidebar shows children of the current page. But if the current page has no children, then I still get the list title “In This Section”. And of course, nothing beneath.
How do I test to see if the current page has no children before calling wp_list_pages?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘run wp_list_pages only when current page has children’ is closed to new replies.