Support » Themes and Templates » Tag pages in the template hierarchy
9 years, 6 months 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.
New info at:
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.
😉 of course that doesn’t address the ‘bug or feature’ question.
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.
Oops, looks like I didn’t search the right places. Thanks for that – tons of helpful stuff there. Thanks!