( taken from
http://wordpress.org/support/topic/30273 )
Hi again,
Instead of messing around with making dramatic changes to files and making a new Page template file I just add a conditional statement within Header.php
<body id="<?php echo (is_page()) ? get_query_var('name') : ((is_home()) ? "home" : ((is_single()) ? "single": ((is_category()) ? single_cat_title() : ((is_archive()) ? "archive" : "")))); ?>">
Yes I know its complex because I have used the short-hand method for writing conditions however here’s what it does;
- If page is a Page grab slug for id
- Else if page is home just hardcode id “home”
- Else if page is a Single post just hardcode id “single”
- Else if page is Category grab category name as id
- Else if page is Archive just hardcode id “archive”
- Else dont know what it is so set id as nothing
Assumptions: Only Pages and Categories will have a unique style per page, other pages will just have a generic style for that type of page.
Hope this helps
simon
January 19th, 2010
sasdaf sadf asdf