Created
December 7, 2011 20:36
-
-
Save nicksatkovich/1444526 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| <?php | |
| if (!$post->post_parent) { | |
| $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0'); | |
| } else { | |
| $p = end(get_post_ancestors($post->ID)); | |
| $children = wp_list_pages('title_li=&child_of='.$p.'&echo=0'); | |
| } | |
| ?> | |
| <?php | |
| if ($children) { | |
| $parent_title = end(get_post_ancestors($post)); | |
| ?> | |
| <h2><?php echo get_the_title($parent_title); ?></h2> | |
| <ul> | |
| <?php echo $children; ?> | |
| </ul> | |
| <?php } ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment