• Hello,

    I want to have a specific style sheet loaded for single posts that are in a specific category. So if the category is “dog” then “dog.css” would be loaded in addition to the style.css file that loads upon every page.

    Would someone help me out with this?

    Thanks in advance,
    Marcus.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You just need a Category Template and also check out
    Different Category Format.

    Thread Starter mymonkeymind

    (@mymonkeymind)

    Thanks for the response, crayoncrisis. And unless I am misreading the information in the links you provided, I could make a specific template for a category, but that would be used for the category page.

    What I want to do is assign a style sheet for a single post (that applies to all posts) in a category.

    Alternatively, Ideally I would like the ability to do it to a for a single post with a specific tag. It makes no nevermind whether I use tags or categories, I just want to assign a stylesheet to a single item page that is either tagged or categorized to a corresponding item. Did that make sense?

    Did I misread something?

    Ah, I think that you are absolutely right. I didn’t get that part. The Template Hierarchy for single post display seems to be:

    1. single.php
    2. index.php

    I’ve been using the Sandbox theme lately, and it has a function giving classes to the body element. Not quite what you were asking about, but it does give you a body with a class like s-category-dog, letting you style that specifically.

    Hope someone else can answer about the seperate style sheets though, I want know that too now that I see this wouldn’t do the trick for a single post.

    Thread Starter mymonkeymind

    (@mymonkeymind)

    I’m also using the Sandbox theme, and the class selectors for individual elements are great. But what I’m looking to do is to style a whole bunch of selectors based upon a particular category or tag.

    Is there a way to put a statement in the single.php page that goes something like:

    if category = dog
    then load dog.css
    else load owner.css?

    this is exactly what I came here looking for!

    Hope there is a solution someday.
    Seems that it shouldn’t be that hard, just not sure what the best way to attack this problem is.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Category specific css’ is closed to new replies.