Cutline Theme for WordPress

One Giant Leap for Mankind

Cutline Theme for WordPress header image 2

Different Backgrounds For Single Categories In Cutline

September 15th, 2007 · 11 Comments · How To

As requested in the forums, a small tutorial on how to use different backgrounds for separate categories in Cutline. Using separate templates for each category is rather simple, you only need some additional lines of code.
If you apply this structure, there are no limitations. You could even use a totally different design for every category, with different header, sidebar and font and many more. No limitations are set.

The only thing needed to do so is a conditional tag, and of course WordPress has the appropriate template tag for this:

(in_category())

Using this condition and a classic if, elseif php call we can change everything we want for the categories we want. Just the post CSS or even the complete design. If you want to feature a complety different design based on pages, use combined conditional tags to define if your new design.

The background images (colored closing tags) and background color for several categories I used on my former blog are easy to achieve.

Open in your theme folder the file index.php or if your theme uses a separate file for the loop, theloop.php and look for following line

Original Cutline Code for Entries

This is the regular entry template and here we will have to change the code a little and insert the conditional tags for the categories we want to alter.

Changed Code For Cutline with Category Conditional Tag

As you could see in the link above, I used a different background for several categories, but there are no limits for this principle.

You can easily use a total new template page for every category, in which case you have to make new template files and call them as in the following screenshot.

Different Entry Template for Different Categories

And obviously you can even call a totally different CSS for every category, or for specific pages. All based on the conditional WP tags.

Now you only need to make the changes to your CSS anymore. In the next screenshot you see a small example of how to achieve this, just like I did at my former blog

CSS example of different styles for different categories

Tags:


11 Comments so far ↓

Leave a Comment (Need help? Visit our Support page and Forums first.)