Skip to content

Instantly share code, notes, and snippets.

@levantoan
Last active November 11, 2019 14:36
Show Gist options
  • Save levantoan/f6712caae6db3fd8df3e to your computer and use it in GitHub Desktop.
Save levantoan/f6712caae6db3fd8df3e to your computer and use it in GitHub Desktop.
remove and change style wordpress admin bar
<style type="text/css" media="screen">
html { margin-top: 32px !important; }
* html body { margin-top: 32px !important; }
@media screen and ( max-width: 782px ) {
html { margin-top: 46px !important; }
* html body { margin-top: 46px !important; }
}
</style>
<?php
//Edit this code to functions.php
//remove admin bar show_admin_bar(false);
//Remove style admin bar
add_action('get_header', 'remove_admin_login_header');
function remove_admin_login_header() {
remove_action('wp_head', '_admin_bar_bump_cb');
}
//Add my style admin bar
function my_admin_css() {
if ( is_user_logged_in() && is_admin_bar_showing()) {?>
<style type="text/css">
/*Code css in here*/
</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