Skip to:
Content
Pages
Categories
Search
Top
Bottom

Way to disable admin bar on certain themes?


  • Ted Mann
    Participant

    @tedmann

    Is there a way to prevent the buddypress admin bar from loading on certain themes?

    In particular, I want to get Alex King’s WordPress Mobile Edition on my Buddypress site, but currently the admin bar always loads with the mobile version of the sites — thus slowing down load time significantly and sort of undermining the point of having the mobile edition in the first place.

    I’ve used the methods of disabling the admin bar sitewide, or via a plugin, but I was hoping that there might be a simple line of code I could add to the mobile-edition theme to force it to not load the bar.

Viewing 13 replies - 1 through 13 (of 13 total)

  • r-a-y
    Keymaster

    @r-a-y

    Hi Tedmann,

    There’s two ways to go about this:

    (1) CSS route:

    In your /wp-content/themes/carrington-mobile-1.0.2/style.css file, add this:

    body {padding-top:0 !important;}
    #wp-admin-bar {display:none !important;}

    (2) Theme functions.php route:

    In your /wp-content/themes/carrington-mobile-1.0.2/functions.php file, add this:

    remove_action( 'wp_footer', 'bp_core_admin_bar' );
    remove_action( 'admin_footer', 'bp_core_admin_bar' );

    Option #1 will simply hide the admin bar from view, however it will still be loaded if you view the HTML source.

    Option #2 will completely remove the admin bar from the HTML source.

    Not completely 100% that code will work, but give it a shot and report back.


    Ted Mann
    Participant

    @tedmann

    Thank you so much for the help, r-a-y.

    The functions.php method didn’t take for some reason, but the css route worked like a charm.

    I really appreciate the advice

    The frontend action needs to look like this

    remove_action( ‘wp_footer’, ‘bp_core_admin_bar’, 8 );

    The backend one from above works.


    Andy Bailey
    Participant

    @commentluv

    remove_action( ‘wp_footer’, ‘bp_core_admin_bar’ ,8);
    remove_action( ‘admin_footer’, ‘bp_core_admin_bar’ ,8);

    worked for me! thanks..it’s because the remove_action command requires the same priority as the original add_action that was used.

    https://codex.wordpress.org/Function_Reference/remove_action


    Matthew Hui
    Participant

    @zazinteractive

    remove_action( ‘wp_footer’, ‘bp_core_admin_bar’ ,8);
    remove_action( ‘admin_footer’, ‘bp_core_admin_bar’ ,8);

    Didn’t work for some reason. The css fix works though

    Hi,

    Thanks for the CSS solution to the admin menu migrating to the bottom in a stretched out hierarchy. While this polishes up my site, but I would really like the admin menu at the top the way it is supposed to be. I have the Executive theme and other than the admin menu I am having a good time working with it.


    pcwriter
    Participant

    @pcwriter

    @maui1

    The adminbar is triggered by the call to wp_footer. So make sure that call is present in your theme.


    Magi182
    Participant

    @magi182

    It actually needs to read:

    `remove_action( ‘wp_footer’, ‘bp_core_admin_bar’, 8);
    remove_action( ‘admin_footer’, ‘bp_core_admin_bar’ );`

    as the admin footer hook has no priority in the current versions of buddypress (1.2.8)

    magi182’s way worked for me.

    thanks a lot


    stripedsquirrel
    Participant

    @stripedsquirrel

    It worked,but leaves a blank space on top of the page and the CSS is still being called in the source.
    Is there a way to remove the admin.css call for just this theme (or better remove the bar and the css for all non-admin users).
    Cheers

    Isn’t there a “disable” option in wp-admin BuddyPress > General Settings ?


    stripedsquirrel
    Participant

    @stripedsquirrel

    There is a ‘hide admin bar for logged out users’ option. But I want the bar on regular BP sites, I just did not want it on a domain-mapped site that is totally separate (though running on the same WP multisite installation).

    http://blog.netweblogic.com/php/wordpress-php/remove-admin-bar-plugin/ did the trick for me.


    stripedsquirrel
    Participant

    @stripedsquirrel

    hmm, the ‘edit’ link on my previous reply 404’s?
    anyway, just saw that that link is dead. Not sure where it came from, but the name of the plugin is “Remove BuddyPress AdminBar”.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Way to disable admin bar on certain themes?’ is closed to new replies.
Skip to toolbar