0

I've created a custom taxonomy and I'm trying to get Wordpress to display the taxonomy template when no term is defined. Currently Wordpress is only showing the template when a term is defined on the URL.

My taxonomy is called projects and defined like this:

$args = array(
    '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",
    ),
    'hierarchical' => TRUE,
    'label' => 'Categories',
    'query_var' => TRUE,
    'rewrite' => array(
            'slug' => 'projects'
    ),
);

register_taxonomy('projects', 'project', $args);

Next to this I have created a template file called taxonomy-projects.php.

Currently when I browse to the http://mysite.com/projects URL, Wordpress falls back to the index.php. How can I make it so that when no term is defined, Wordpress shows my taxonomy-projects.php template?

UPDATE:

I should have added this straight away, I'm clearing my rewrite rules each time I make a change to try again.

2 Answers 2

1

I had a similar issue. I ended up using the archives.php and had a little more luck with that. It would see and use the archives.php (and the archives-video.php I created from it), but would not see taxonomy.php or taxonomy-videos.php or category.php like it should.

0

Have you tried flushing your rewrite rules?

If not, go to Dashboard -> Settings -> Permalinks, and click "save" (no need to make any changes), to force WordPress to flush the rewrite rules.

1
  • Sorry. Yes. I know about resetting the rewrite rules. I do this every time I make a change. No luck.
    – Luke
    Jul 17, 2011 at 2:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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