Forums

[resolved] Extra elements in admin bar (5 posts)

  1. DomenLo
    Member
    Posted 9 months ago #

    I'd like to add "Plugins" and "Add new plugin" to the Network admin dropdown in the admin bar.

    What would be the easiest way to go about this?

    Thanks!

  2. Brett Shumaker
    Member
    Posted 9 months ago #

    This works for me...I'm not sure if you can somehow combine the two items and only call $admin_bar->add_menu( $args); once.

    add_action('admin_bar_menu', 'add_items',  100);
    function add_items($admin_bar)
    {
        $args = array(
                'id'    => 'plugins',
                'title' => 'Plugins',
                'href'  => 'plugins.php',
                'meta'  => array(
                        'title' => __('Plugins'),
                        ),
                );
    
        $admin_bar->add_menu( $args);
        $args = array(
                'id'     => 'add-plugin',
                'title'  => 'Add New',
                'href'   => 'plugin-install.php',
                'meta'   => array(
                        'title' => __('Add New Plugin'),
                        ),
                'parent' => 'plugins',
                );
    
        $admin_bar->add_menu( $args);
    }

    EDIT: This should go into your theme's functions.php file.

  3. DomenLo
    Member
    Posted 9 months ago #

    Thank you very very much.

  4. Brett Shumaker
    Member
    Posted 9 months ago #

    No problem!

  5. DomenLo
    Member
    Posted 9 months ago #

    In case anyone stumbles on this topic, this also came out recently: http://wordpress.org/extend/plugins/multisite-admin-bar-tweaks/

    Both variants work flawlessly.

Reply

You must log in to post.

About this Topic