【发布时间】:2013-02-28 07:27:50
【问题描述】:
我用 WordPress 建立了一个网站,并且我有自定义的帖子类型。 在某些页面中,我有子导航,我想在页面中显示它,如下图所示:
http://www.andreavisibelli.com/screen-1.jpg
效果很好,不是吗?
是的,但是如果您尝试查看下图中的“Vini”页面,您将看不到子菜单:
http://www.andreavisibelli.com/screen-2.jpg
两个子菜单的区别在于第一个是WordPress的基本页面,第二个是自定义的帖子页面!
我的代码是:
<ul id="subnavigation">
<?php
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 } ?>
</ul>
我该如何解决这个问题?
【问题讨论】:
标签: wordpress wordpress-theming submenu