Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have created custom post type, taxonomy and categorys. When viewing the category it seems to be using index.php and ignoring the WordPress template hierarchy.

Any ideas why category.php, category-{id}.php etc aren't working for the custom post type categorys but working fine for regular posts?

thanks

add_action('init', 'collegestampede_register');

function collegestampede_register() {

    $labels = array(
        'name' => 'College Stampede', 'post type general name',
        'singular_name' => 'Member', 'post type singular name',
        'add_new' => 'Add New', 'stampede item',
        'add_new_item' => 'Add New Member',
        'edit_item' => 'Edit Member',
        'new_item' => 'New Member',
        'view_item' => 'View Member',
        'search_items' => 'Search Member',
        'not_found' => 'Nothing found',
        'not_found_in_trash' => 'Nothing found in Trash',
        'parent_item_colon' => ''
    );

    $args = array(
        'labels' => $labels,
        'public' => true,
        'publicly_queryable' => true,
        'show_ui' => true,
        'query_var' => true,
        'menu_icon' => get_stylesheet_directory_uri() . '/article16.png',
        'rewrite' => true,
        'capability_type' => 'post',
        'hierarchical' => false,
        'has_archive' => true,
        'menu_position' => null,
        'supports' => array('title','editor','thumbnail','excerpt',)

      ); 

    register_post_type( 'stampedemember' , $args );

register_taxonomy("Location", array("stampedemember"), array("hierarchical" => true, "label" => "Location", "singular_label" => "Location", "rewrite" => true));
share|improve this question
    
Please post relevant code, including primarily the register_taxonomy() call, and, if necessary, the register_post_type() call. –  Chip Bennett Oct 8 '13 at 17:21
    
@ChipBennett - added the relevant code. Thanks. –  Storm3y Oct 8 '13 at 17:24
    
@Storm3y category.php and category-{id}.php work only for standard categories. For the taxonomy Location you should use taxonomy-location.php or taxonomy-location-{slug}.php –  G. M. Oct 8 '13 at 17:34
    
@G.M.taxonomy-location.php doesn't appear to be working either. –  Storm3y Oct 8 '13 at 17:35
add comment

1 Answer

For a custom taxonomy named Location (p.s. you may have issues with a capitalized slug), per the Template Hierarchy, the taxonomy archive index template file is taxonomy-{taxonomy}.php, or taxonomy-Location.php (note capitalization).

share|improve this answer
    
taxonomy-location.php or taxonomy-Location.php doesn't appear to be working –  Storm3y Oct 8 '13 at 18:09
    
Why? Can you post a live link to a page that should be using that template? –  Chip Bennett Oct 8 '13 at 18:10
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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