Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Custom Post Type Custom Taxonomy Archive Page WordPress



I have a custom post type called Class Schedule with custom taxonomies. Just trying to figure out how to create a category archive page.

archive-class-schedule.php doesn't seem to work. The only thing that seems to work is the archive.php file but I need to save it for the blog part of the site.

Any help is greatly appreciated.


Answers (5)


Alessendro answers:

Your question title says custom taxonomy archive page, but you are using the custom post type archive template, which is archive-postype.php

With reference to WordPress Template Hierarchy, If you want a custom taxonomies display, it should be

1) taxonomy-{taxonomy}-{term}.php - If the taxonomy were sometax, and taxonomy's slug were someterm WordPress would look for taxonomy-sometax-someterm.php. In the case of Post Formats, the taxonomy is 'post_format' and the terms are 'post-format-{format}. i.e. taxonomy-post_format-post-format-link.php
2) taxonomy-{taxonomy}.php - If the taxonomy were sometax, WordPress would look for taxonomy-sometax.php

There is no custom post type custom taxonomy archive page.
Custom taxonomy can exist without custom post type.
So what you need is a taxonomy template.

Hope it helps.


Christianto answers:


Did you register your post type with 'class-schedule' as name too?

Maybe we could register it without hyphen symbol

so archive page will be archive-classschedule.php


Denzel Chia answers:


Please refer to WordPress Template Hierarchy

Categories and Archives are "different" things.
I believe you are looking for "Custom Post Type Display"
archive-{post_type}.php - If the post type were product, WordPress would look for archive-product.php.

Just like what Christianto has said archive-class-schedule.php will not work,
archive-classschedule.php will work.

You need to redo your custom post type.



Erez S answers:

You've tried archive-class-schedule.php but the syntax is archive-[POST_TYPE_NAME].php.
Now the post type name is depends on the name you've wrote while created the post type, and you can find out the name simply go to the dashboard and click on the post type and look at the address and you should see something like that:[POST_TYPE_NAME]
And then just rename the file to the correct name. Gratz.


Lucas Wynne answers:

Name the page like this category-ID.php and put the ID for the category where "ID" is.

Everything you need can be found here: [[LINK href=""]][[/LINK]]