Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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