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've registered a couple of custom taxonomies to go with a couple of custom post types but I'm having some trouble getting a template file to work.

I've tried taxonomy.php, taxonomy-[termname].php, taxonomy-[taxonomyname].php but none seem to register and the link reverts to index.php

You can see an example of this here - http://wordman.deanelliott.me/portfolio/ just click on any of the links inside the yellow box and instead of going to a specific taxonomy template page it uses index.php

I'm not sure if it makes a difference, but this is the code I'm using to register the taxonomy

register_taxonomy('cat', 'portfolio',  array('hierarchical' => false, 'label' => 'Category','query_var'  => true, 'rewrite' => true));
share|improve this question

2 Answers 2

up vote 0 down vote accepted

I think this is because you use a reserved name: http://codex.wordpress.org/Function_Reference/register_taxonomy#Reserved_Terms

Try changing in to something else like:

register_taxonomy('portfolio_category', 'portfolio',  array('hierarchical' => false, 'label' => 'Category','query_var'  => true, 'rewrite' => true));
share|improve this answer
    
That stopped index.php from being used, but it still doesn't seem to want to use any of the taxonomy template files I created (It doesn't seem to use any, all I get is the header and footer, no content) –  Dean Elliott Dec 20 '11 at 23:51
    
Are you sure the taxonomy.php template has some code in it (besides get_header and get_footer)? Here you can see the template hierarchy: codex.wordpress.org/images/1/18/Template_Hierarchy.png It has to be one of those templates under custom taxonomy archive. And don't forget to flush your permalink rewrite rules (go to permalinks under settings and thats done). –  Rob Vermeer Dec 20 '11 at 23:56
    
I just went back to the test site to do this and it appears to be working now. Maybe it was just the browser cache playing tricks on me. Thanks for your help anyway –  Dean Elliott Dec 21 '11 at 10:13

I think you need to have the 'portfolio' inside an array like this:

<?php
register_taxonomy( 'cat', array( 'portfolio' ),  
  array(
    'hierarchical' => false, 
    'label' => 'Category',
    'query_var'  => true, 
    'rewrite' => true)
  );
?>
share|improve this answer

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.