WordPress.org

Ready to get started?Download WordPress

Forums

category tempaltes=different themes for different cats? (3 posts)

  1. jaimebienlesfruits
    Member
    Posted 7 years ago #

  2. Jeremy Clarke
    Member
    Posted 7 years ago #

    if you create a file in your theme called 'category-$id.php' then it will be applied to only the category with the id of $id (i.e. whatever the categories id is).

    If you want a totally different theme for that category, then you can just make that one file be completely different from the rest of the files in your theme. The complicated part is that you'll have to make sure that all the included files (like sidebar, header) are either all in that one file (category-28.php), or that the file includes special versions of those includes (so you'd have to rename them sidebar-28.php or something). You'll also have to include a different CSS file etc.

    Hmmm.. rereading your quesetion, if the HTML is always the same, then do you mean that it's only the CSS that changes? In that case you could have the if statements in ONLY the header where the CSS gets loaded. Alternately, you can make special versions of the header and use the category-28.php trick above to load different versions of the header for the special categories.

  3. Kwebble
    Member
    Posted 6 years ago #

    With category templates you can create pages for categories as different as you want. Sticking to the default files like header.php etc. may be difficult because the HTML must fit in each template.

    But you don't need to split things up that way. I've created 3 category pages on my site which each output complete HTML pages. One category for normal blog posts including a linklog on the side, one for a photo log with one photo per page and a category for one specific topic with some different styling.

    I did create some reusable parts like a comment form.

Topic Closed

This topic has been closed to new replies.

About this Topic