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.

Posted in Code, WordPress | 1 Comment

echo ‘Hello World!’;

So this is the obligatory ‘Hello World’ post. I’ve attempted blogging before, no doubt I’ll fail again, but I’ll try harder this time :)

Posted in Uncategorized | Leave a comment