WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Tag pages in the template hierarchy (5 posts)

  1. shacker
    Member
    Posted 6 years ago #

    While building a site that utilizes tagging heavily, I realized something surprising: URLs displayed at /tags/foobar are handled by archive.php, not by category.php. This is:

    A) Surprising, considering the close relationship of tags and categories elsewhere in the system.

    B) Frustrating, because I want to be able to use the same template for pages accessed at /tags/foo or /category/bar

    Does anyone know why archive.php is being invoked rather than category.php? Is this a bug or a feature? Thanks.

  2. MichaelH
    Member
    Posted 6 years ago #

    New info at:
    http://codex.wordpress.org/Template_Hierarchy#Tag_page
    Here's the hierarchy:
    1. The Tag Template with a matching slug. If the tag's slug is sometag, WordPress would look for tag-sometag.php first.
    2. tag.php
    3. archive.php
    4. index.php

    ;) of course that doesn't address the 'bug or feature' question.

  3. shacker
    Member
    Posted 6 years ago #

    Interesting - Thanks for that. So is there an is_tag() conditional I can use for template routing? I don't see any mention of it in the codex.

  4. MichaelH
    Member
    Posted 6 years ago #

  5. shacker
    Member
    Posted 6 years ago #

    Oops, looks like I didn't search the right places. Thanks for that - tons of helpful stuff there. Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic