Copy this code to your functions.php file
add_action( 'bp_setup_nav', 'wdes_bp_add_nav_item', 100 ); function wdes_bp_add_nav_item(){ // Add music page in my profile menu item bp_core_new_nav_item( array( 'name' => 'My Music', 'slug' => 'my-music', 'default_subnav_slug' => 'sub-music', 'screen_function' => 'my_music_screen_function', 'show_for_displayed_user' => true, 'position' => 160 ) ); // Add upload music page in my profile menu item under music page bp_core_new_subnav_item( array( 'name' => __( 'Upload Music' ), 'slug' => 'upload-music', 'parent_url' => $bp->loggedin_user->domain . 'profile', 'parent_slug' => 'profile', 'screen_function' => 'upload_music_screen_function_callback', 'position' => 20, ) ); } function my_music_screen_function() { add_action( 'bp_template_content', 'my_music_bp_template_content' ); bp_core_load_template( 'bp_template_content' ); } function my_music_bp_template_content(){ // Create a file inside your theme folder and follow this file path "buddypress/members/single/profile/my-music.php" bp_get_template_part( 'buddypress/members/single/profile/my-music' ); // Add your custom code inside my-music.php } function upload_music_screen_function_callback() { add_action( 'bp_template_content', 'upload_music_bp_template_content' ); bp_core_load_template( 'bp_template_content' ); } function upload_music_bp_template_content(){ // Create a file inside your theme folder and follow this file path "buddypress/members/single/profile/upload-music.php" bp_get_template_part( 'buddypress/members/single/profile/upload-music' ); // Add your custom code inside upload-music.php }
Leave a Reply