You should be able to keep the wpadminbar
from overlaying your navigation bar by using either JavaScript or a combination of PHP
and CSS
.
I would add this php to the header.php file of your theme:
<?php if ( is_admin_bar_showing() ) { ?>
<style>
.my-nav-bar {
position: absolute;
top: [wpadminbar-height]px;
}
</style>
<?php } ?>
Basically, position absolute your navigation below the wpadminbar
when it’s visible.
The other option to move your navigation below the wpadminbar
is to use JavaScript to get the height of the wpadminbar
and add it to the top
CSS property of your navigation container.
OR
If your navigation is positioned absolute and nested inside a div
that is parallel to the wpadminbar
, you could add this to your CSS:
.container {
position: relative;
}
.admin-bar .container {
position: relative;
padding-top: [wpadminbar-height]px;
}