我试图将子菜单加入到我的主题中,但在导航到BuddyPress页面时遇到了问题(与标准WP页面、帖子等相反)。基本上,我想做的是让页面(在适当的情况下)显示一个子菜单,ala:
但当我浏览到BuddyPress控制下的页面时,我会得到以下信息:
我使用以下命令生成子菜单:
if (is_page()) {
global $wp_query;
if( empty($wp_query->post->post_parent) ) {
$parent = $wp_query->post->ID;
} else {
$parent = $wp_query->post->post_parent;
}
if(wp_list_pages("title_li=&child_of=$parent&echo=0" )) { ?>
<ul id="subnav">
<?php
wp_list_pages("title_li=&child_of=$parent&echo=1" );
?>
</ul>
<?php
}
}
我在哪里误入歧途?