Last active
March 15, 2016 00:01
-
-
Save qutek/040c7e40a6bd898de761 to your computer and use it in GitHub Desktop.
[Wordpress][Buddypress] Add new menu item buddypress profile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function custom_bp_nav() { | |
global $bp; | |
bp_core_new_nav_item( | |
array( | |
'name' => __( 'Site Settings', 'buddypress' ), | |
'slug' => 'site-settings', | |
'position' => 80, | |
'screen_function' => 'site_settings_screen', | |
'default_subnav_slug' => 'site-settings', | |
'parent_url' => $bp->loggedin_user->domain . $bp->slug . '/', | |
'parent_slug' => $bp->slug | |
) ); | |
} | |
function site_settings_screen() { | |
// bp_core_load_template( 'item-one-template' ); // if just need to load a page template for your custom item. You'll need to have an item-one-template.php in your theme root. or | |
//add title and content here - last is to call the members plugin.php template | |
add_action( 'bp_template_title', 'site_settings_screen_title' ); | |
add_action( 'bp_template_content', 'site_settings_screen_content' ); | |
bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) ); | |
} | |
function site_settings_screen_title() { | |
echo 'Site Settings'; | |
} | |
function site_settings_screen_content() { | |
echo 'Content here'; | |
} | |
add_action( 'bp_setup_nav', 'custom_bp_nav', 50 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment