Support » Fixing WordPress » Template Hierarchy for page-archives.php?

Viewing 5 replies - 1 through 5 (of 5 total)
  • You mean on the category archives page? Sure, that’s easy. You can just create a new category template for whatever categories you want.

    For example, if your sermons category’s ID is 8, then you just create a category page template called category-8.php. Put this commented code at the top so WP recognizes it as a custom Page template:

    Template Name: Sermons

    As joni mentioned, you can create a category template for a specific category. See here for more:

    Note that a template for a category and one used as a Page template should be managed separately. You can do as joni describes above to have WordPress recognize say category-8.php as a Page template as well, but when assigned as a Page template it will not behave as you may expect (that is, displaying posts from category 8).

    Thanks Joni and Kaf, I think that’s what I have now. loads 1-archives.php category page, which over-rides the archive.php.
    The question I had… was when you click on the individual post, (I guess that would be a single post, or perhaps a single archive posts) it defaults back to the archive.php, and loses my defined dynamic sidebar, which I set in the category-1.php.
    Will I need to set up a conditional tag in the archive file to load this dynamic sidebar for category 1 entries? Or, is there a “hierarchy” that covers the single posts (or would this be considered a single archive post?).

    You need to re-read the Template_Hierarchy article.
    a) archive1.php – is not a recognizable template file for your monthly or category archives/listing
    b) for different category archives you need category-XX.php files, where XX is the cat ID#
    c) single posts are displayed by single.php template file (or, if missing, whatever comes next according to Template_Hierarchy)
    d) Different single layout:
    (a plugin)

    I found a great idea on Lorelle’s page which works very well. I tried using Kaf’s plugin; but had problems getting it to work properly.

    btw, the template hierarchy article is really very helpful!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Template Hierarchy for page-archives.php?’ is closed to new replies.