How to Make Category Specific Designs

One of the things Ben and I want to do on the SideStream Media website is allow for category specific CSS files. The reason we want to do this is so we can move all of our podcasts to one site and still make each podcast’s page look a little different. Revision 3 does this with it’s show pages, http://revision3.com/tekzilla/ and http://revision3.com/systm/ as 2 examples. The way we solved this issue was by calling on a .css file based on either what category page you were on or what category the post you are viewing is in. The code for this is :

<? if (is_category()) { ?>
<link rel=”stylesheet” href=”<? bloginfo(‘stylesheet_directory’); ?>/<?php single_cat_title(); ?>.css” type=”text/css” />
<? } elseif (is_single()) {?>
<link rel=”stylesheet” href=”<? bloginfo(‘stylesheet_directory’); ?>/<?php foreach((get_the_category()) as $cat)
{echo $cat->cat_name. ”;} ?>
.css” type=”text/css” />
<? } ?>

This code should go right after the link to you main CSS file. Once you have done this you just need to create CSS files in your themes folder by the same name as the category, and for most servers this will be case sensitive. You can see this code in action on some of the categories on this site. If you have any questions or know of a better way to do this please let me know.