我想在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 );
}
Run Code Online (Sandbox Code Playgroud)
所以,我可以看到带有文本"Tester"的选项卡,但是当我点击我被定向到另一个页面(http:// localhost/my-site/members/my-user/tester /)时,其中的内容来自'tester.php'显示在用户活动上方.
先感谢您.