[Support request] Disable Admin Bar

Home Forums Support [Support request] Disable Admin Bar

Home Forums Support Disable Admin Bar

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #431044
    Brennen

    I am wondering if it is possible to disable the admin bar for specific pages of my choosing. I have tried to use CSS but it doesn’t seem to work right and everything I try in JS disables it all the time and not on specific pages.

    #431101
    Leo
    Staff
    Customer Support

    Hi there,

    There are a few options in this post: https://generatepress.com/forums/topic/hide-admin-bar-for-all-users/

    Give it a shot?

    #431104
    Brennen

    Thanks for the suggestion but those are for removing it all the time, I am only trying to remove it from a couple of pages.I recently tried `if ( !is_page(‘Landing’) ) {
    add_filter(‘show_admin_bar’, ‘__return_false’);
    }` but it didn’t work and removed it all the time, any suggestions on editing this code to get it to target the pages?

    #431195
    Tom
    Lead Developer
    Lead Developer

    Maybe this?:

    add_action( 'wp', 'tu_remove_admin_bar' );
    function tu_remove_admin_bar() {
        if ( ! is_page( 'Landing' ) ) {
            add_filter( 'show_admin_bar', '__return_false' );
        }
    }
    #431197
    Brennen

    Just tried it and it still removed the admin bar on every page and not just the one page :(. Also when I disable it on mobile the menu gets pushed up and only half of it shows.

    #431200
    Tom
    Lead Developer
    Lead Developer

    The ! in there makes it so it applies to every single page except for that one.

    If you remove the !, it should only apply to the “Landing” page.

    #431201
    Brennen

    unfortunately its now showing on every page including ‘Landing’ even after I removed the !

    #431245
    Tom
    Lead Developer
    Lead Developer

    Grr, just made another adjustment, can you give it another shot?

    Thanks!

    #431607
    Brennen

    New code works great! Only problem is that on the other pages the admin bar shows up bank on mobile, but I have a feeling this is a setting in buddypress.

    #431740
    Tom
    Lead Developer
    Lead Developer

    Ah yea – I think I’ve seen that before. Might be worth checking with their support.

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.