<body <?php if (function_exists('body_class')) { body_class(); } ?>>
Then do a view source on whatever page your looking to modify and you can see specific body css classes you can use.
For example:
<body class=”page page-id-6 page-parent page-template page-template-archive-comic-php logged-in ie”>
This is my archive page, root level page for all the different archive pages I have. It says the page-id-6 .. so if say I wanted a specific background or background color for this page I would do:
body .page-id-6 { background: #ccc; }
if I wanted to hide say the title which in my css the element is div class=”pagetitle”
.page-id-6 .pagetitle { display: none; }
that will make that .pagetitle on that specific page, disappear.
Notice the body classes also include if someone is logged in or not and since they are logged in I want to, I dunno make the title white /shrug
.logged-in .pagetitle { color: #fff; }
With body_class you can pretty much do anything to any specific page on your site just by getting a class from the body_class that is individual for just that page.
*the IE that you see in the body class was added there by an function in my functions.php*
add_filter('body_class','browser_body_class');
function browser_body_class($classes = '') {
global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone;
if($is_lynx) $classes[] = 'lynx';
elseif($is_gecko) $classes[] = 'gecko';
elseif($is_opera) $classes[] = 'opera';
elseif($is_NS4) $classes[] = 'ns4';
elseif($is_safari) $classes[] = 'safari';
elseif($is_chrome) $classes[] = 'chrome';
elseif($is_IE) $classes[] = 'ie';
else $classes[] = 'unknown';
if($is_iphone) $classes[] = 'iphone';
return $classes;
}
That will add the type of browser the end user is using to the body_class.. but you can also do some fun things with it as well.
For example, If you want to say do some code that is specific for the browser type checking out your system:
if (reset(browser_body_class()) == ‘ie’) {
print “Only people with IE browsers will see this.\r\n”;
}
^ the reset() makes the array turn into a string.