• Resolved Steve McConnell

    (@mcstevem)


    Our site includes a template that generates an email-friendly newsletter assembled from published posts. Because we copy the source code for a newsletter issue from a page preview, we suppress the admin bar using

    add_filter('show_admin_bar', '__return_false');

    However, with Branda activated, the unstyled admin bar displays above the newsletter contents for logged-in users when viewing or previewing the page; screenshot at https://coengineeringd.wpengine.com/wp-content/uploads/2023/02/Branda-addminbar.png

    Our newsletter editors are not HTML coders, which is why we we remove that content from the view. Asking them to trim out those lines of code manually would be asking for trouble.

    Is there some other way we can suppress the admin bar on view/preview for all users, while retaining the flexibility and customization Branda offers? Thanks.

    ~ Steve

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support Kris – WPMU DEV Support

    (@wpmudevsupport13)

    Hi @mcstevem

    I hope you are doing well today.

    Based on the page source it does not look like wordpress site (that template). However, based on screenshot, where your users are logged in, and with review of same page source it seems that your template does not call WP core at all. What I mean here styles and JS files. That is why your admin bar look like this.

    First solution will be to edit each user profile and disable this feature: Show Toolbar when viewing site.

    Second solution will be to use this CSS in Appearance -> Customize -> Additional CSS section:

    .logged-in #wpadminbar {display:none;}

    Note this will affect other roles, including admins.

    Kind Regards,
    Kris

    I can confirm this is an issue. Disabling “show toolbar when viewing site” does not actually hide the toolbar, and using the 'show_admin_bar' filter is overridden by Branda. I’ve had to resort to conditionally adding CSS to hide the toolbar manually.

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @lulech23

    Thank you for the update.

    I checked and can confirm, yes it will be overridden by the Branda plugin.

    displays above the newsletter contents for logged-in users when viewing or previewing the page;

    Is it any specific role that you would be looking into hiding the bar? You can use Branda > Admin Area > Admin Bar > Toolbar Visibility and disable the front end using Branda instead CSS or that filter.

    Best Regards
    Patrick Freitas

    In my case, I want the admin toolbar to show for Administrators and Editors only. I have Branda set to hide the admin bar for Subscribers and Guests, but the toolbar is not actually hidden for these roles. Instead, the toolbar is visible, but empty (no links). Maybe it’s because I have also customized the content of the admin bar? If so, there would appear to be a conflict between the customization and visibility features in Branda.

    Since admin bar hooks in functions.php are overridden by Branda as well, that’s why I’ve had to resort to CSS overrides. Otherwise, Branda forces it to be visible regardless of settings.

    Thread Starter Steve McConnell

    (@mcstevem)

    This is what our developer did in the page template for the particular custom post type where we want to remove the Admin Bar:

    remove_all_filters ('show_admin_bar', 9223372036854775807);
    add_filter('show_admin_bar', '__return_false');

    The first line removes all filters being applied to the show_admin_bar hook. It needs to have that very large “priority” number, because Branda set their filter to that priority.

    Once that filter is gone, the second line removes the Admin Bar from that page.

    ~ Steve

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @mcstevem

    Thank you for the explanation,

    I assume that priority will bypass the issue and it is now “Resolved” ?

    Best Regards
    Patrick Freitas

    Thread Starter Steve McConnell

    (@mcstevem)

    Yes, at least it resolved the problem we were having.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Hidden admin bar is not hidden with Branda’ is closed to new replies.