0

I'm looking at the Codex about template hierarchy. However, I have a custom post type with many categories from a custom taxonomy I created also.

This post type allows users to add new categories to their posts. I read in the codex that I can create a taxonomy-{taxonomy-name}.php template file for each of my taxonomies. What I am wondering is if I can create one template file to "catch" all of the CPT's categories.

  • Your question is a bit difficult to follow, because it reads as if category and taxonomy are interchangeable. Just for clarity: what all taxonomies are registered for your CPT? Regarding categories, which is a specific taxonomy: did you add post-type support for the category taxonomy? And which taxonomy do you wish to display for this particular template file? – Chip Bennett Mar 1 '13 at 0:41
0

I think it's worth clarifying a bit of terminology first:

  • Taxonomy - a set of related terms
  • Term - an entry (I want to just say "term") in a taxonomy
  • Categories - a taxonomy that's in the default WordPress
  • Tags - a taxonomy that's in the default WordPress
  • Category - a term in the Categories taxonomy
  • Tag - a term in the Tags taxonomy
  • Custom taxonomy - a non-default taxonomy in WordPress

So the taxonomy-{taxonomy-name}.php template targets all terms in a specific taxonomy. taxonomy-{taxonomy-name}-{term}.php targets a specific term in a taxonomy.

I'd encourage you to take a look at the Template Hierarchy flow chart from the Codex. From what you describe it sounds like you either need to use archive.php that affects all archives (assuming you haven't specified a more-specific template) or taxonomy.php which targets all Custom Taxonomy archives (so not Categories or Tags).

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.