Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

olehellhound on "Toolbar Roles"

$
0
0

Hello,

I'm creating a plugin and I got the idea to create menus in the WP Toolbar for my backend pages. I've added a user as a subscriber and want for the menu that I have created to appear in the subscribers' admin bar because there will be dynamic content created within my plugin. Is this possible, and if so, how do I do it? Here is my code:

//admin bar objects
add_action( 'admin_bar_menu', 'toolbar_link_to_mypage', 999 );
function toolbar_link_to_mypage( $wp_admin_bar ) {
  $args = array(
    'id' => 'Spectrum',
    'title' => 'Manage Spectrum',
    'href' => site_url('/spectrum'),
    'meta' => array('class' => 'Spectrum-page')
  );
  $wp_admin_bar->add_node($args);
}

Thanks


Viewing all articles
Browse latest Browse all 8245

Trending Articles