logo

$20
Custom Post Type Custom Taxonomy Archive Page

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

Denis Leblanc | 07/07/11 at 7:54pm | Edit


(5) Possible Answers Submitted...

  • avatar
    Last edited:
    07/08/11
    1:15am
    Christianto says:

    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

  • avatar
    Last edited:
    07/08/11
    2:25am
    Denzel Chia says:

    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.

  • avatar
    Last edited:
    07/08/11
    2:44am
    Alessendro says:

    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.

  • avatar
    Last edited:
    07/08/11
    11:10am
    Erez S says:

    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.

  • avatar
    Last edited:
    07/08/11
    3:55pm
    Lucas Wynne says:

    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: http://codex.wordpress.org/Category_Templates

This question has expired.



Denis Leblanc voted on this question.



Current status of this question: Completed