DiggingIntoWordPress

by Chris Coyier & Jeff Starr

Tag: body

Advanced WordPress Targeting with body_class_plus()

Posted by on

Since WordPress 2.8, we can target specific types of page views with CSS using the new body_class() tag. Designed for use within the <body></body> element, body_class() outputs various class attributes according to the current type of page view. This makes it easy to apply page-specific styling such as current-page navigation highlighting and other nifty CSS tricks.

Unique Body ID’s for your Pages

Posted by on

There are many reasons you might want to get a unique ID for your <body></body> tag. Let’s say you want your header elements to be a different color on your About page, you could apply a bit of CSS via your theme’s stylesheet (i.e., style.css). For example, you could target the About page with something like this:

Code is poetry