Skip to content

Instantly share code, notes, and snippets.

@benjibee

benjibee/functions.php

Last active Apr 21, 2020
Embed
What would you like to do?
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

This comment has been minimized.

Copy link
Owner Author

@benjibee benjibee commented Apr 21, 2020

image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.