Skip to content

Instantly share code, notes, and snippets.

@tcmulder
Last active December 20, 2023 18:51
Show Gist options
  • Save tcmulder/8871741 to your computer and use it in GitHub Desktop.
Save tcmulder/8871741 to your computer and use it in GitHub Desktop.
Makes the WordPress admin bar small and unobtrusive up in the corner of the screen.
/*
* Mini Admin Bar
* Modified from plugin URI: http://www.netyou.co.il/
* Description: Makes the admin bar a small button on the left and expands on hover.
*/
add_action('get_header', 'my_filter_head');
function my_filter_head() { remove_action('wp_head', '_admin_bar_bump_cb'); }
function my_admin_css() {
if ( is_user_logged_in() && get_current_user_id() == 1) {
?>
<style type="text/css">
#wpadminbar:not(:hover) {
position: fixed;
left: 1px;
top: 1px;
width: 20px;
height: 20px;
min-width: 20px;
overflow: hidden;
opacity: .15;
border-radius: 50%;
}
#wpadminbar:after {
content: "";
position: absolute;
background: #008000;
top: 0;
bottom: -100px !important;
right: 0;
left: 0;
/*IE hack*/
background-color: #fff;
filter:alpha(opacity=0);
opacity: 0;
}
#wpadminbar:not(:hover) #wp-admin-bar-wp-logo {
margin-left: -8px !important;
margin-top: -6px !important;
}
</style>
<?php }
}
add_action('wp_head', 'my_admin_css');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment