Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I was wondering if and how is it possible in Wordpress to set a different theme for a specific category of contents (in my case the blog).

I'm on WP 3.3.1.

Thank you so much in advance.

Any help will be sincerely appreciated.

share|improve this question
add comment

migrated from stackoverflow.com Mar 6 '12 at 15:26

This question came from our site for professional and enthusiast programmers.

2 Answers

WordPress can only use one Theme at a time. You cannot (and, really, should not) change Themes on-the-fly. (There are edge cases; search the Plugin repository for Theme Switcher Plugins for implementation examples.)

That said, that doesn't mean that a single Theme can't output different styles based on the current context; and, really, that's what you're after here.

The first step is understanding the Template Hierarchy; in your case, you're primarily interested in Category templates. The primary takeaway here is that you can use specific template files for specific category contexts; i.e. you can define a category-foobar.php template file to output the Foobar category archive index.

The second step is understanding the body_class() template tag, and the context-specific CSS classes that this tag adds to the HTML <body> tag. The primary takeaway here is that WordPress will add category-specific CSS classes to the HTML <body> tag for specific category contexts; i.e. WordPress will add category and category-foobar as classes on the Foobar category archive index, which you can target via CSS with e.g. body.category-foobar.

The rest becomes a matter of HTML and CSS, which is best left as an exercise for the reader.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.