/ Published in: PHP

Based on code via Tammy Hart - slight modification to exclude current page.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php if($post->post_parent) $children = wp_list_pages(‘title_li=&child_of=’.$post->post_parent.’&exclude=’.$post->ID.’&echo=0′); else $children = wp_list_pages(‘title_li=&child_of=’.$post->ID.’&exclude=’.$post->ID.’&echo=0′); if ($children) { ?> <li> <h5> <?php $parent_title = get_the_title($post->post_parent); echo $parent_title; ?> </h5> <ul> <?php echo $children; ?> </ul> </li> <?php } } ?>
Comments
