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

  • SOLVED

Hello,

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.

Denis

Answers (5)

2011-07-08

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

<blockquote>
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
</blockquote>

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.

2011-07-08

Christianto answers:

Hi,

Did you register your post type with 'class-schedule' as name too?
register_post_type('class-schedule',$args);

Maybe we could register it without hyphen symbol
register_post_type('classschedule',$args);

so archive page will be archive-classschedule.php

2011-07-08

Denzel Chia answers:

Hi,

Please refer to WordPress Template Hierarchy
http://codex.wordpress.org/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.

Thanks.

2011-07-08

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:
http://www.domain.com/wp-admin/edit.php?post_type=[POST_TYPE_NAME]
And then just rename the file to the correct name. Gratz.

2011-07-08

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="http://codex.wordpress.org/Category_Templates"]]http://codex.wordpress.org/Category_Templates[[/LINK]]