WordPress.org

Ready to get started?Download WordPress

Forums

Custom template for single within a category (6 posts)

  1. hayfordoleary
    Member
    Posted 8 years ago #

    I'm looking to have my template customised if it's affiliated with a certain category. I know that I can use is_category() for the archive of the category, but I don't know how to (or if I can) do anything to a post within the category.

    Just to be clear, an example post is "Billy's Bike Store" under the category "Local Businesses", category ID 10. So is there some way to say, if the parent category ID is "10", print {text}?

    (I'm running WP 2.0, if it makes a difference)

  2. Orin
    Member
    Posted 8 years ago #

    Yes, there defeinately is. Check out this thread. My method is to define a different CSS class for every category I want affected, but you can go deeper down that rabbit hole if you like.

  3. moshu
    Member
    Posted 8 years ago #

  4. Orin
    Member
    Posted 8 years ago #

    Yes, that also would work. The first method would be if you were having all the different posts on the same page, the second on their individual post and category pages.

  5. moshu
    Member
    Posted 8 years ago #

    Well, the title of the topic asks for "custom template for single within a category". The plugin does exactly that.
    Single means one post, not "different posts on the same page".

  6. Orin
    Member
    Posted 8 years ago #

    Yes, it does — fair enough. I'm just a little post-happy for something I think I know how to explain.

    (better luck next time...)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags