【发布时间】:2015-01-25 23:11:33
【问题描述】:
我正在尝试在 BuddyPress 的“用户配置文件”菜单中创建一个额外的选项卡。 到目前为止,我可以在菜单中看到选项卡,但是当我单击选项卡时,我被引导到另一个页面,在那里我可以看到所有内容的顶部和用户活动列表,而不是看到内容在菜单下(例如当您单击活动、朋友、消息等时) 我希望这是有道理的......这是我的代码:
function my_setup_nav() {
global $bp;
bp_core_new_nav_item( array(
'name' => __( 'Tester', 'buddypress' ),
'slug' => 'tester',
'position' => 30,
'screen_function' => 'test_template',
) );
}
function test_template() {
add_action( 'bp_template_content', 'test_template_two' );
bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
}
function test_template_two() {
locate_template( array( 'buddypress/members/single/tester.php' ), true );
}
所以,我可以看到带有“Tester”文本的选项卡,但是当我单击时,我会被定向到另一个页面 (http://localhost/my-site/members/my-user/tester/),其中“tester.php”的内容显示在用户活动上方。
提前谢谢你。
【问题讨论】:
标签: wordpress buddypress