Hi,
If we hide the admin bar on frontend for authors, the admin bar disappears but doing scroll the sticky menu doesn’t stay at top. It leaves a blank space where the admin bar was supposed to be.
We find out it was a theme css issue, and we made the following changes:
.admin-bar .td-header-menu-wrap.td-affix {
top:0;
}
That works well for authors but not for admins. The sticky menu now stays behind the admin bar. How can we workaround this?
Tks
Hello,
Please do not hide the admin bar using css. If you want to hide the admin bar, use php code to do so as you will break the css:
http://www.wpbeginner.com/wp-tutorials/how-to-disable-wordpress-admin-bar-for-all-users-except-administrators/
Thanks
Hi,
I have tried to remove the admin bar with a code such as this one for example
– http://www.wpbeginner.com/wp-tutorials/how-to-disable-wordpress-admin-bar-for-all-users-except-administrators/
This removes the admin bar
– https://www.screencast.com/t/Yhdw7WCO3
But for me it does not create sticky menu issues
– https://www.screencast.com/t/2GsCFxJD
Maybe I am not using the same settings as you are, from what I can see there is no issue with the sticky menu after removing the admin bar.
Thanks
That code would apply if there is still an admin bar displayed, by using a code such as the one I mentioned the admin bar will not be loaded anymore except for admins, so the CSS for it will not apply as well.
The best way to remove the admin bar is either with a code such as that one, or disable it in the WordPress settings
– https://www.screencast.com/t/gX3Lbcrxng
The admin bar is hidden and the code it’s still active.
See the image: http://www.screencast.com/t/jkL6EAblWrm
For me the website does not look like that
– https://www.screencast.com/t/CpDKxrNAkW
That CSS code is not found in the page. So maybe the issue happens only for admin, if you disabled the admin bar for other roles. How exactly did you remove the admin bar? I could try as you did and see what exactly happens.
It’s better to hide admin bar using php filter
// Disable Admin toolbar on frontend
add_filter('show_admin_bar', '__return_false');
Refer: https://www.infophilic.com/disable-wordpress-toolbar/