mindfullsilence
10/23/2014 - 4:22 PM

Wordpress - static admin bar

Wordpress - static admin bar

if(!is_admin() && is_user_logged_in()) {
	remove_action( 'wp_footer', 'wp_admin_bar_render');
	add_action( 'wp_head', 'wp_admin_bar_render', 1000 );

	function make_admin_bar_static() {
		echo '
        <style type="text/css">
        html[lang] {
          margin-top: 0px !important;
        }

        #wpadminbar {
        	position: static !important;
        }
        </style>
        ';
	}
	add_action('wp_head', 'make_admin_bar_static');
}