When you think of having two stylesheets for a website or blog, you typically think of an alternate stylesheet specifically for a web browser, such as an Internet Explorer stylesheet.
One thing we haven’t covered yet is how to add a second stylesheet that is only used for certain pages. In order to do this, you’ll want to open up your header.php file and locate your existing stylesheet. The stylesheet code should look something like this:
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
Now, we need to make an adjustment so that it will only show the code in a certain situation. For example, if you want a certain category to use a different stylesheet, you’d use the following code:
<?php if ( is_category('1') ) { ?>
<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/cat-1.css"
type="text/css" media="screen" />
<?php } else { ?>
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>"
type="text/css" media="screen" />
<?php } ?>
In this example, we are assigning the cat-1.css to be used for category 1. Every other page will use the normal stylesheet.
You can plugin in alternate information as needed.














There Are 13 Responses So Far »
Pingback: 100+ Killer Wordpress Resources | Steffan Antonas' Blog
Pingback: Collection of WordPress Hacks | WordPress Hacks
Pingback: Wordpress – How to do. - Web Development Notes