Skip to:
Content
Pages
Categories
Search
Top
Bottom

Help customising admin bar, removing links from dropdown


  • leanneoleary
    Participant

    @leanneoleary

    Hi,

    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 );
Viewing 1 replies (of 1 total)

  • @mcuk
    Participant

    @mcuk

    Hi @leanneoleary,

    I can help with your first q (if your’e still looking). Add to your bp-custom file:

    //WP Admin Bar - Remove edit-profile tab from dropdown menu
    function remove_admin_bar_edit_profile( $wp_admin_bar ) {
    	$wp_admin_bar->remove_node( 'edit-profile' );
    }
    add_action( 'admin_bar_menu', 'remove_admin_bar_edit_profile', 999 );

    To remove the activity, substitute ‘activity’ wherever it says ‘edit_profile’ in code above. note also the ‘my-account-activity’ eg:

    //WP Admin Bar - Remove activity tab from dropdown menu
    function remove_admin_bar_activity( $wp_admin_bar ) {
    	$wp_admin_bar->remove_node( 'my-account-activity' );
    }
    add_action( 'admin_bar_menu', 'remove_admin_bar_activity', 999 );

    for profile: sub in ‘xprofile’ and ‘my-account-xprofile’
    for notifications: sub in ‘notifications’ and ‘my-account-notifications’
    for messages: sub in ‘messages’ and ‘my-account-messages’
    for friends: sub in ‘friends’ and ‘my-account-friends’
    for settings: sub in ‘settings’ and ‘my-account-settings’

Viewing 1 replies (of 1 total)
  • The topic ‘Help customising admin bar, removing links from dropdown’ is closed to new replies.
Skip to toolbar