Last active
April 21, 2020 12:25
-
-
Save benjibee/f06e35f40772add60caaf706dd5c7a81 to your computer and use it in GitHub Desktop.
Wordpress: Move adminbar to bottom, expand on hover
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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); | |
} |
Author
benjibee
commented
Apr 21, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment