WordPress.org

Ready to get started?Download WordPress

Forums

Unique Post Template For Each Category? (3 posts)

  1. Joe Hall
    Member
    Posted 4 years ago #

    Hi there! I am trying to create a post template for post in a certain category. In other words, when a user opens a post's permalink they get a different layout/template if the post is in a certain category.

    I have already looked at the Category Template page, and it appears that is only for category archives.

    I have considered using a conditional tag, but doing so seems a bit excessive use of code.

    Is there any other solutions?

  2. This is not what you want from the Category Template doc?:

    So, if you want to make the Category whose ID number is 6 look different from what it is currently (and different from other Category pages), you would want to create a category-6.php file. If you want to make all Category pages look different from other archive pages (such as date and author archives), then you would want to create or modify the category.php file.

    Possibly along with a conditional tag to select a different style sheet for each category?

  3. Peter Boosten
    Member
    Posted 4 years ago #

    Every post has an extra ID attached to it, called category-<yourcategoryname>

    I'm sure you can do something with that.

    Peter

Topic Closed

This topic has been closed to new replies.

About this Topic