WordPress.org

Forums

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

  1. DomenLo
    Member
    Posted 2 years 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. brettshumaker
    Member
    Posted 2 years 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 2 years ago #

    Thank you very very much.

  4. brettshumaker
    Member
    Posted 2 years ago #

    No problem!

  5. DomenLo
    Member
    Posted 2 years 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.

Topic Closed

This topic has been closed to new replies.

About this Topic