Forums

Hack: Template switching in archive.php based on category ID? (2 posts)

  1. databell96
    Member
    Posted 2 years ago #

    I know this can be done but I haven't figured out the best way to do it. I've got a couple of blog categories and what I want is when category id 3 is triggered, it loads up a different archive.php page (and likewise, a different single.php page) which will have the same headers and footers but the content inside the respective archive and single.php pages will be a lot different. I'm no programmer but I'm aware it's got to be some kind of if-else statement. I just need to what kind of code I should be placing, in which files and between which lines or areas of code. Any help on this would be greatly appreciated.

  2. vtxyzzy
    Member
    Posted 2 years ago #

    You can get the unique 'archive' by creating a file named category-3.php. See the Codex on Template Hierarchy.

    See this article for instructions on creating a single.php for certain categories.

Topic Closed

This topic has been closed to new replies.

About this Topic