下面是添加指向自定义模板的菜单项的示例。如果要链接到现有BP元素,则需要查找适当的操作。将此添加到functions.php
:
// Set up Cutsom BP navigation
function my_setup_nav() {
global $bp;
bp_core_new_nav_item( array(
\'name\' => __( \'Item One\', \'buddypress\' ),
\'slug\' => \'my-item-one\',
\'position\' => 30,
\'screen_function\' => \'my_item_one_template\',
) );
bp_core_new_nav_item( array(
\'name\' => __( \'Item Two\', \'buddypress\' ),
\'slug\' => \'my-item-two\',
\'position\' => 20,
\'screen_function\' => \'my_item_two_template\'
) );
// Change the order of menu items
$bp->bp_nav[\'messages\'][\'position\'] = 100;
// Remove a menu item
$bp->bp_nav[\'activity\'] = false;
// Change name of menu item
$bp->bp_nav[\'groups\'][\'name\'] = ‘community’;
}
add_action( \'bp_setup_nav\', \'my_setup_nav\' );
// Load a page template for your custom item. You\'ll need to have an item-one-template.php and item-two-template.php in your theme root.
function my_item_one_template() {
bp_core_load_template( \'item-one-template\' );
}
function my_item_two_template() {
bp_core_load_template( \'item-two-template\' );
}
希望有帮助!更多有关本文的信息
Themekraft.