CPT Taxonomy archive

Forgive me for being dumb, but I’m super confused about how roots works. I’m clear that the archive pages don’t work as they normally would but beyond that I don’t know what to do. I’m working on a site that uses the Types plugin to create CPTs (not sure if it matters how I create them) and I want to create a custom archive page for the CPT taxonomies (not the CPT category itself). Could someone please point me in the right direction?

If you look at the comments in this post http://roots.io/an-introduction-to-the-roots-theme-wrapper/ @Foxaii explains this pretty well.

This post gives a good breakdown on how Roots plays along with the WordPress template hierarchy: Development using Roots

Thanks for the replies. I get how to create a template for CPTs, which both of these articles explain well, but neither of them seem to mention how to make an archive page for a CPT Taxonomy or Category. I’ve tried so many variations but none of them seem to work. I feel like I’m just missing something so simple and obvious.

This is the order in which WordPress checks for your template files, taken directly from Development using Roots


Custom Taxonomies

  1. taxonomy-(taxomony)-(term).php (if doesn’t exist, falls back to…)
  2. taxonomy-(taxomony).php (if doesn’t exist, falls back to…)
  3. taxonomy.php (if doesn’t exist, falls back to…)
    4.* archive.php (if doesn’t exist, falls back to…)*
  4. index.php

So, if you have a custom taxonomy called foo_categories and one of your a custom categories is called bar, its archive template file would need to be taxonomy-foo_categories-bar.php. If you want all your custom Foo categories to use the same template you would just create one template file called taxonomy-foo_categories.php.

Note that these should be in the root of the theme directory, NOT in the templates directory!

I’d like to point out that archive pages work the same in Roots… the theme wrapper removes the need to call get_header and get_footer, and helps sort things better, but it doesn’t change how archive pages work. Wanted to clear that up.

Also, I was thinking of setting up an archive page yesterday for a project for the taxonomies of a CPT, not the terms or single taxonomy, but for the entire taxonomy to show an archive of it’s taxonomy terms, that doesn’t actually exist in WP. Not sure if that was your goal or not. But you would need to list it out using get_terms() manually.