Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #2718

    Hi.

    I need to have a special css for a special category.

    CIt would also be usefull to Append a Pre-test – Could be the category name itself – to the post titles in this special category.

    How could I do this (what would be the best method)?

    My idea about css would be to insert some css class if the post would have this category but I don’t know if this would be too heavy for the site. About the pre-text to the Post title, I have no clue how to do it.

    Can you give me a push here?

    BR

    Dinis

    #39039

    Hey,

    WP appends the category as a class to the body element. I.e.:

    <body id='top' class="archive category category-offer-and-promotions en">

    or

    <body id='top' class="archive category category-your-world en">

    So basically you need to write your css code like:

    .category-your-world #main{
    background: #ff0000;
    }

    .category-offer-and-promotions #main{
    background: #ff1111;
    }

    Pre text is a bit more complex but it’s possible by using conditional tags: http://codex.wordpress.org/Conditional_Tags

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘special css for a certain category’ is closed to new replies.