我用下面的代码,以显示我的3级菜单:WordPress站点导航
if(!$post->post_parent){
// will display the subpages of this top level page
$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
}else{
// diplays only the subpages of parent level
//$children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
if($post->ancestors) {
// now you can get the the top ID of this page
// wp is putting the ids DESC, thats why the top level ID is the last one
$ancestors = end($post->ancestors);
$children = wp_list_pages("title_li=&child_of=".$ancestors."&echo=0");
// you will always get the whole subpages list
}
}
if ($children) { ?>
<ul id="submenu">
<?php echo $children; ?>
</ul>
<?php } ?>
它列出在边栏页,第二水平,那么第三级了。我想包括最高层过,所以我想我的结构看起来如下:
*A
-a
--a
-b
--b
-c
--c
其中在如上代码没有上市的主网页即* A,我希望实际意义,有人会能够帮助
感谢,
你能否澄清?如果你在页面上--a,你想在边栏中显示什么?如果你在页面-b上,你想在边栏中显示什么? – Groovetrain 2011-03-11 18:37:22