WordPress.org

Forums

Add Links to WordPress 3.3 Multisite Toolbar (1 post)

  1. leadingdesigns
    Member
    Posted 3 years ago #

    I need to add a link to the toolbar to be used by the Super Admin of a Multisite setup managing several sites.

    The link I need to add to the toolbar is simply a shortcut to the same menu item in each specific admin area. The problem is, when I add a link to the toolbar within the admin area of one site, and then enter the admin area of a second site - clicking the link on the toolbar of the second site takes me back to the admin area of the first.

    I have found the following script that will add a link in a non-WPMS environment, for a link with 2 sub-menus:

    <?php
    
    add_action('admin_bar_menu', 'add_toolbar_items', 100);
    function add_toolbar_items($admin_bar){
    	$admin_bar->add_menu( array(
    		'id'    => 'my-item',
    		'title' => 'My Item',
    		'href'  => '#',
    		'meta'  => array(
    			'title' => __('My Item'),
    		),
    	));
    	$admin_bar->add_menu( array(
    		'id'    => 'my-sub-item',
    		'parent' => 'my-item',
    		'title' => 'My Sub Menu Item',
    		'href'  => '#',
    		'meta'  => array(
    			'title' => __('My Sub Menu Item'),
    			'target' => '_blank',
    			'class' => 'my_menu_item_class'
    		),
    	));
    	$admin_bar->add_menu( array(
    		'id'    => 'my-second-sub-item',
    		'parent' => 'my-item',
    		'title' => 'My Second Sub Menu Item',
    		'href'  => '#',
    		'meta'  => array(
    			'title' => __('My Second Sub Menu Item'),
    			'target' => '_blank',
    			'class' => 'my_menu_item_class'
    		),
    	));
    }
    
    ?>

    Is there any way this script can realise which multisite I am in, and take me to the menu item within the correct admin area? Any help would be much appreciated!

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 3 years ago by leadingdesigns
  • This topic is not resolved
  • WordPress version: 3.3.1