1
2
3
4
5
6
7
8
9
10
11
12
13
14 <?php global $wp_query;
$post = $wp_query->post;
$ancestors = get_post_ancestors($post);
if( empty($post->post_parent)) {
$parent = $post->ID;
} else {
$parent = end($ancestors);
}
if(wp_list_pages("title_li=&child_of=$parent&echo=0")) { ?>
<ul>
<?php wp_list_pages("title_li=&child_of=$parent&depth=0"); ?>
</ul>
<?php } ?>
wp_nav_menu()
December 8, 2012/ Updated: December 8, 2012