将子导航菜单项添加到伙伴新闻菜单

时间:2013-02-08 作者:Adam

在按Buddy键的情况下,向父菜单项添加子导航菜单项时遇到问题。

父菜单项如下所示,名为TEST, 正确显示,但名为SUB NAVSUB NAV 2 根本不显示。

function my_setup_nav() { 
global $bp; 
$em_link = $bp->loggedin_user->domain . $bp->account->slug . \'/\';

# - add parent menu item    

bp_core_new_nav_item( array( 
    \'name\' =>  \'TEST\',
    \'slug\' =>  $bp->account->slug, 
    \'position\' => 10,
    ) 
); 

# - add sub nav menu items

bp_core_new_subnav_item( array( 
    \'name\' => \'SUB NAV\',
    \'slug\' => \'account-sub\', 
    \'parent_url\' =>  $em_link ,
    \'parent_slug\' => $bp->account->slug,
    \'position\' => 10,
    \'item_css_id\' => \'xx\' 
    ) 
); 
bp_core_new_subnav_item( array( 
    \'name\' => \'SUB NAV 2\',
    \'slug\' => \'account-sub-2\', 
    \'parent_url\' =>  $em_link ,
    \'parent_slug\' => $bp->account->slug,
    \'position\' => 20,
    \'item_css_id\' => \'xx-2\' 
    ) 
); 
} 

add_action( \'bp_setup_nav\', \'my_setup_nav\', 99 );
使子导航项正常工作的正确语法是什么?

1 个回复
最合适的回答,由SO网友:shanebp 整理而成

此处询问并回答:http://buddypress.org/support/topic/create-sub-nav-menu-item-in-profile/

您是否尝试过建议的解决方案?

结束

相关推荐

BuddyPress:删除用户配置文件页面中的论坛选项卡?

我需要删除用户配置文件页面中的论坛选项卡。我尝试了很多事情,但没有结果。我不想用css来做。尝试了以下操作:http://www.themightymo.com/2012/01/26/how-to-add-remove-and-change-the-order-of-buddypress-component-menu/ 但运气不好。有什么建议吗?提前谢谢你,艾米丽