Skip to content

Instantly share code, notes, and snippets.

@benjibee
Last active April 21, 2020 12:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benjibee/f06e35f40772add60caaf706dd5c7a81 to your computer and use it in GitHub Desktop.
Save benjibee/f06e35f40772add60caaf706dd5c7a81 to your computer and use it in GitHub Desktop.
Wordpress: Move adminbar to bottom, expand on hover
<?php
// move admin bar to bottom of screen when viewing site
function benjibee_modify_adminbar()
{
?>
<style>
div#wpadminbar {
top: auto;
bottom: 0;
position: fixed;
width: 35px;
min-width: unset;
transition: all 150ms;
}
#wpadminbar:not(:hover) {
background: transparent;
}
#wpadminbar:hover {
width: 100%;
}
#wp-admin-bar-wp-logo .ab-icon:before {
color: #aaa;
}
.ab-sub-wrapper {
bottom: 32px;
}
html[lang] {
margin-top: 0 !important;
margin-bottom: 32px !important;
}
@media screen and (max-width: 782px){
.ab-sub-wrapper {
bottom: 46px;
}
html[lang] {
margin-bottom: 46px !important;
}
}
</style>
<?php
}
if (is_user_logged_in()) {
add_action('wp_head', 'benjibee_modify_adminbar', 100);
}
@benjibee
Copy link
Author

image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment