• I have created a custom taxonomy for my site called projects with a matching template called taxonomy-projects.php. The problem is that when I browse to http://mysite.com/projects the template is not triggered, index.php is, but when I browse to http://mysite.com/projects/someterm the template shows up just fine.

    How can have my template displayed when I browse to http://mysite.com/projects?

    Before you ask. Yes, I’m aware that I need to clear the rewrite rules before changes are made. I do this by saving the Permalink settings in the admin.

    This is how I’ve created my custom taxonomy:

    $args = array(
    	'public' => TRUE,
    	'hierarchical' => TRUE,
    	'query_var' => TRUE,
    	'rewrite' => array(
    		'slug' => 'projects',
    		'with_front' => TRUE,
    	),
    	'labels' => array(
    	'name' => "Categories",
    	'singular_name' => "Category",
    	'search_items' => "Search Categories",
    		'popular_items' => "Popular Categories",
    		'all_items' => "All Categories",
    		'parent_item' => "Parent Category",
    		'parent_item_colon' => "Parent Category:",
    		'edit_item' => "Edit Category",
    		'update_item' => "Update Category",
    		'add_new_item' => "Add New Category",
    		'new_item_name' => "New Category Name",
    	),
    );
    
    register_taxonomy('projects', array('project'), $args);

    I’ve traced the output of $wp_query->get_queried_object() on each page and when I browse to a page with an existing term, such as http://mysite.com/projects/commercial I get the following output:

    stdClass Object
    (
        [term_id] => 4
        [name] => Commercial
        [slug] => commercial
        [term_group] => 0
        [term_taxonomy_id] => 8
        [taxonomy] => projects
        [description] =>
        [parent] => 0
        [count] => 1
    )

    However, when I browse to http://mysite.com/projects the output is nothing, empty output.

    I’m failing to understand what I’m doing wrong. How can I make the taxonomy-projects.php shown when I browse to http://mysite.com/projects?

    Any help would be greatly appreciated.

  • The topic ‘Why is my taxonomy template not shown?’ is closed to new replies.