Forums

Separate template for Archives too... (2 posts)

  1. anithegregorian
    Member
    Posted 3 years ago #

    I have done templating for different categories in WP ie. If I have a categoryID - 18 and I want to display the contents of this category differently than all other generic categories then I can create category-18.php write some code in it and thats it! I have a custom template for categoryID 18, but what about archive pages? Can I create a separate theme for categoryID 18's archive page? Ive tried using archive-18.php which was a hunch that turned out to be a FIASCO :)

    Or Is it the good old way of putting a conditional block in PHP check for categories and render them from there, another hunch...

  2. Michael Fields
    Theme Wrangler
    Posted 3 years ago #

    As far as my understanding if template hierarchy goes, category-18.php should override the need for a file such as archive-18.php. Check out the chart. See category-x.php will be called instead of archive.php for all "category archive" views where the category queried is equal to x.

    Perhaps I am not understanding your question, would you like to change the display of certain posts on say a month or year archive view? If so, you want to look into using Conditional Tags in the loop inyou archive.php file.

    Hope this is helpful.

Topic Closed

This topic has been closed to new replies.

About this Topic