Created
March 15, 2017 06:45
-
-
Save 1naveengiri/d3c6d5594035e9f63a59b7149e32546e to your computer and use it in GitHub Desktop.
Code to add Album menu as Top Level WordPress Profile Menu.
This file contains 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 to add Album menu as main menu in WordPress Profile menu. | |
*/ | |
if ( ! function_exists( 'rtmedia_add_album_main_menu' ) ) { | |
function rtmedia_add_album_main_menu() { | |
// Please change the page_slug if you want from here | |
$page_slug = 'album'; | |
$page_title = __('Album','buddypress-media' ); | |
// check if RTMEDIA_MEDIA_SLUG is already defined | |
if ( defined( 'RTMEDIA_MEDIA_SLUG' ) ) { | |
global $wp_admin_bar; | |
$wp_admin_bar->add_menu( array( | |
'parent' => 'my-account', | |
'id' => 'my-account-media-' . $page_slug, | |
'title' => $page_title, | |
'href' => trailingslashit( get_rtmedia_user_link( get_current_user_id() ) ) . RTMEDIA_MEDIA_SLUG .'/'.$page_slug, | |
'meta' => array('class'=>'menupop') | |
) ); | |
} | |
} | |
} | |
add_action( 'rtmedia_add_admin_bar_media_sub_menu', 'rtmedia_add_album_main_menu', 10 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment