Different background-image by category

You can do this using WordPress’s handy body_class() function. Depending on whether and how it is used in your theme, it may already be giving you what you need. Here’s how to find out:

Check the source of your page to see if the <body> tag in your category archive pages has any classes containing your category slug: category-apple, category-area, category-usa, etc. These will typically be included by default.

  • If they are there, you can use these as selectors in your CSS: body.category-apple { /* code here */ }, etc.

  • If not, add the body_class() function to the <body> tag in your theme, probably located in header.php. It works like this:

    <body <?php body_class(); ?>>

Optionally, you can add any extra class you want as a parameter.

Here’s the entry in the WordPress Codex: http://codex.wordpress.org/Function_Reference/body_class