Support » Fixing WordPress » Change the color of admin bar – follow up

  • Resolved Dave

    (@dvaer)


    Further to the reply on this closed topic, I’d like to suggest a small improvement to the code posted in the answer.

    To change the background color of the admin bar into a custom color, this code works for me:

    add_action('wp_head', 'change_bar_color');
    add_action('admin_head', 'change_bar_color');
    function change_bar_color() { ?>
    	<style>
    		#wpadminbar {
    			background: #8C0000;
    			transition: background .4s;
    		}
    		#wpadminbar:hover {
      			background: #BA0000;
      		}
    	</style>
    <?php }

    You could further customize the CSS there to also apply the new colors to the dropdown menus, but if all you want to do is change the color of the bar, this will work.

    You’d add it to your functions.php file or a functionality plugin.

    • This topic was modified 2 months ago by Dave.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.