Group Mods

  • Profile picture of @mercime
  • Profile picture of r-a-y
  • Profile picture of Hugo

Way to disable admin bar on certain themes? (14 posts)

Started 2 years, 10 months ago by: Ted Mann

  • Profile picture of Ted Mann Ted Mann said 2 years, 10 months ago:

    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.

  • Profile picture of r-a-y r-a-y said 2 years, 10 months ago:

    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.

  • Profile picture of Ted Mann Ted Mann said 2 years, 10 months ago:

    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

  • Profile picture of ch8rt ch8rt said 1 year, 11 months ago:

    The frontend action needs to look like this

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

    The backend one from above works.

  • Profile picture of Andy Bailey Andy Bailey said 1 year, 9 months ago:

    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.

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

  • Profile picture of zazinteractive zazinteractive said 1 year, 9 months ago:

    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

  • Profile picture of maui1 maui1 said 1 year, 5 months ago:

    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.

  • Profile picture of pcwriter pcwriter said 1 year, 5 months ago:

    @maui1

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

  • Profile picture of Magi182 Magi182 said 1 year, 1 month ago:

    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)

  • Profile picture of gleezer gleezer said 1 year, 1 month ago:

    magi182′s way worked for me.

    thanks a lot

  • Profile picture of stripedsquirrel stripedsquirrel said 10 months, 1 week ago:

    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

  • Profile picture of Paul Gibbs Paul Gibbs said 10 months, 1 week ago:

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

  • Profile picture of stripedsquirrel stripedsquirrel said 10 months, 1 week ago:

    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.

  • Profile picture of stripedsquirrel stripedsquirrel said 10 months, 1 week ago:

    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”.