Last active
November 11, 2019 14:36
-
-
Save levantoan/f6712caae6db3fd8df3e to your computer and use it in GitHub Desktop.
remove and change style wordpress admin bar
This file contains 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
<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> |
This file contains 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 | |
//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