Taxonomy Templates

I don’t quite understand how to link to my taxonomy templates. Do I need to make a page-tempalte and query my terms from there? I’m using the taxonomy hierarchy currently:

Taxonomy

Read More
$labels = array(
        'name'              => __( 'Product Categories' ),
        'singular_name'     => __( 'Product Category' ),
        'search_items'      => __( 'Search Product Categories' ),
        'all_items'         => __( 'All Product Categories' ),
        'parent_item'       => __( 'Parent Product Category' ),
        'parent_item_colon' => __( 'Parent Product Category:' ),
        'edit_item'         => __( 'Edit Product Category' ), 
        'update_item'       => __( 'Update Product Category' ),
        'add_new_item'      => __( 'Add New Product Category' ),
        'new_item_name'     => __( 'New Product Category' ),
        'menu_name'         => __( 'Product Categories' ),
    ); 
    $args = array(
        'labels'            => $labels,
        'show_in_nav_menus' =>  false,
        'hierarchical'      => true,
        'rewrite'           =>  array('slug' => '/products', 'with_front' => false),
    );
    register_taxonomy( 'protax', 'product', $args );

Then I have a taxonomy template : taxonomy-protax.php which I should be able to get to via www.mywebsite.com/products but it keeps leading to 404. Taxonomy template always seem to give me the most trouble… How do I view my taxonomy-protax.php page?

Related posts

1 comment

  1. According to the Codex:

    taxonomy-{taxonomy}.php – If the taxonomy were sometax, WordPress would look for taxonomy-sometax.php

    What I do when using custom taxonomy/custom post types is exactly what you mentioned in the second sentence. Make a page template and a page in the back end. Choose the template you built as the template to use when making your page.

    Template Selector

    EDIT

    Just noticed that you’re getting a 404. In that case, check your permalink structure as well.

    Again, from the Codex:

    If your site uses custom permalinks, you will need to flush your permalink structure after making changes to your taxonomies, or else you may see a “Page Not Found” error. Your permalink structure is automatically flushed when you visit Settings > Permalinks in your WordPress dashboard.

Comments are closed.