Skip to content

Instantly share code, notes, and snippets.

@1naveengiri
Created March 15, 2017 06:45
Show Gist options
  • Save 1naveengiri/d3c6d5594035e9f63a59b7149e32546e to your computer and use it in GitHub Desktop.
Save 1naveengiri/d3c6d5594035e9f63a59b7149e32546e to your computer and use it in GitHub Desktop.
Code to add Album menu as Top Level WordPress Profile Menu.
<?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