I am building a wordpress site and in the sidebar I wanting to show the sub nav of the section the user in, so I would like to show something like if they were on the abo开发者_高级运维ut page,
About Links Useful Contacts
However at the moment I have only managed to the child pages out (Links, Useful Contacts), how would I show the show the parent link as well currently my code looks like this,
if($post->post_parent)
$children .= wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
else
$children .= wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
if ($children) { ?>
<ul>
<?php echo $children; ?>
</ul>
<?php } ?>
Which version of WP are you using? If you are using > 3.0, then you should start using wp_nav_menu. It's a lot more managable.
But here is a good tutorial on how to use sub-navigation in WP:
http://www.svennerberg.com/2009/02/creating-a-submenu-in-wordpress/
精彩评论