Hide Admin Bar + Sticky Menu = Bug

Posted in: Newspaper
Post count: 53

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

Post count: 22421

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

Post count: 53

Hi Bogdan,

I never said we used css to hide the admin bar…

First we used Adminimize and then php code. The problem is with the theme css. I explained on my first post.

Tks

Post count: 20688

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

Post count: 53

Hi Simion,

The css code that is causing the blank space is this one:

.admin-bar .td-header-menu-wrap.td-affix {
top: 32px;
}

It’s a theme css code.

Tks

Post count: 20688

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

Post count: 53

The admin bar is hidden and the code it’s still active.

See the image: http://www.screencast.com/t/jkL6EAblWrm

Post count: 20688

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.

Post count: 53

The admin bar appears to login users only.

But we think the problem is resolved. It appears the problem was a conflict with a plugin.

Tks for the help.

Post count: 623

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/

Viewing 10 posts - 1 through 10 (of 10 total)
The forum ‘Newspaper’ is closed to new topics and replies.