Change WordPress admin header based on multisite blog

This evening on the [wp-ui] mailing list, @andrea_r said how cool it would be to be able to change the header color in the WordPress admin area, based on the blog you were on using the new multisite functionality in 3.0.

I thought it would be cool too, so I made a quick ‘n dirty plugin to do that very thing:

<?php
/*
Plugin Name: Site Colors
Plugin URI: http://www.alexhemptonsmith.com
Description: Lets you define the header color for specific sites
Author: Alex Hempton-Smith
Version: 0.1
Author URI: http://www.alexhemptonsmith.com
*/

function site_colors(){

 $site = get_current_site();

 // Site with ID of 1 has a header with a red background
 if ($site->blog_id == 1)
 $header_color = 'red';

 // Site with ID of 2 has a header with a black background
 if ($site->blog_id == 2)
 $header_color = '#000';

 if ($header_color)
 echo "<style type='text/css'>#wphead {background: $header_color !important;}</style>";
}
add_action('admin_print_styles', 'site_colors');

You can download the plugin here.

This entry was posted in Code, WordPress. Bookmark the permalink.

One Response to Change WordPress admin header based on multisite blog

  1. Pingback: JIMMY

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>