WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The theme that I'm developing is basically a portfolio, where the projects are custom post type and they are divided in categories (custom taxonomies). Here is how I'm defining both:

$labels = array(
    'name' => _x('My Portfolio', 'post type general name'),
    'singular_name' => _x('Portfolio Item', 'post type singular name'),
    'add_new' => _x('Add New', 'portfolio item'),
    'add_new_item' => _x('Add New Portfolio Item', 'add new portfolio item'),
    'edit_item' => _x('Edit Portfolio Item', 'edit portfolio item'),
    'new_item' => _x('New Portfolio Item', 'new portfolio item'),
    'view_item' => __('View Portfolio Item'),
    'search_items' => __('Search Portfolio'),
    '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' => null,
    'rewrite' => true,
    'capability_type' => 'post',
    'hierarchical' => false,
    'menu_position' => null,
    'supports' => array(null)
register_post_type('portfolio', $args);

register_taxonomy('project_category', array('portfolio'), array(
    'hierarchical' => true,
    'label' => "Project Categories",
    'singular_label' => "Project Category",
    'rewrite' => true

So in the homepage I'm listing all terms for the tax. "project_category" and I want a template file for a single term (for example, "jQuery Plugins" or "WordPress Themes") where I can list all project with that term.

I looked in the WP template hierarchy and I believe the template that I need is


My file is named taxonomy-project_category.php and it doesn't find it. I also tried with taxonomy.php, term.php, archive.php ... no success. I think the problem is with the links:

<a href="<?php echo $term->slug; ?>"><?php echo $term->name; ?></a>

Any ideas? Cheers

share|improve this question
What happens if you go to www.yoursite.com?product_category=jquery-plugins? And what do you mean doesn't find it? Doesn't find the template or doesn't find the content? – Stephen Harris May 5 '12 at 18:10
up vote 1 down vote accepted

It seems from the OPs answer that the problem was not to do with the template, but using an incorrect url.

To get the link of a taxonomy term you can use get_term_link():

  <a href="<?php echo get_term_link($term,'product_category')?>"><?php echo $term->name; ?></a>
share|improve this answer

The taxonomy templates support taxonomy-{taxonomy}-{slug}.php so have you tried:

// for the term Jquery Plugins, please alter to actually match what your term slug is

That name format looks a little weird, you might want to consider using project-category instead.

Also turn on debugging and install the debug bar.

share|improve this answer

I found the solution myself, I'm posting this just in case anyone finds this question.

The problem was in the link, this is how it should look like:

<a href="<?php echo get_bloginfo('url') . '/project_category/' . $term->slug; ?>"><?php echo $term->name; ?></a>
share|improve this answer

Your Answer


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.