0

I am trying to customise my admin bar. I have achieved most of what I need to do but am stuck on a couple of things.

  1. I want to remove most of the links from the dropdown menu that appears when you moveover, "How are you, Name?". I want to keep the top part with the profile link and image but want to remove all the links below that. ie. Activity, Profile, Notifications, Messages.

  2. I want to use a font icon for the Home link but this doesn't appear, random characters appear instead. Does anyone know why? My code is below:

//add home page link in top left adminbar - want to use font icon but its not working.
add_action('admin_bar_menu', 'add_toolbar_items', 100); 

function add_toolbar_items($admin_bar){     
    $admin_bar->add_menu( array(         
        'id'    => 'home',         
        'title' => '<i class="fa fa-home"></i>',         
        'href'  => '/',         
        'meta'  => array(             
            'title' => __('Home'),                     
            ),     
        ));     

 } 
//trying to remove Activity, Profile, Notifications, Messages etc links but doesn't do anythingW
remove_action( 'bp_adminbar_menus', 'bp_adminbar_blogs_menu', 6 );
remove_action( 'bp_adminbar_menus', 'bp_adminbar_notifications_menu', 8 );
1

If you want to remove items from the toolbar you could try using $wp_admin_bar->remove_node like so:

You'll have to use an inspect element to find out the IDs but if you would want to remove the WordPress logo you could inspect it and see:

<li id="wp-admin-bar-wp-logo" class="menupop"> … </li>

Then you would target the ID like so:

function remove_wp_logo( $wp_admin_bar ) {
    $wp_admin_bar->remove_node( 'wp-logo' );
}
add_action( 'admin_bar_menu', 'remove_wp_logo', 999 );

I'm not sure if Font-Awesome is installed with BBPress ( I know it's not in WordPress ) so you'll need to make sure you admin-enqueue the fonts first. Otherwise, you'll have to work with Dashicons ( which is installed into WordPress )

  • Thank you I have used Css to remove the part of the menu Idontwant. I have already installed fontawsome and its working fine throughout the site apart from on the admin bar. – LeeTee Apr 28 '15 at 21:12
  • @LeeTee - Installed font-awesome how? It's working fine throughout the Admin Panel? If it's through a plugin it may only be installed on the front-end of your website only. You should be able to View Source ( CTRL + U ) and see the font-awesome css linked somewhere, is it in the header or footer? – Howdy_McGee Apr 28 '15 at 21:14
  • 1
    Ive used wp_enqueue_style to add the stylesheet to the front end. I want to add the homepage icon to the admin bar on the front end. I assume from what your saying I need to install it to the admin panel as well. Thanks for your help. – LeeTee Apr 29 '15 at 8:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.