I'm trying to figure out how to display a list of specific taxonomy (categorycourses
).
In functions.php
for the theme I have:
//Register custom taxonomy for courses-categories
$course_cat_args = array(
'hierarchical' => true,
'labels' => $course_cat_labels, //Other labels set before
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'rewrite' => array( 'hierarchical' => true )
);
register_taxonomy( 'categorycourses', array('course'), $course_cat_args );
The actual taxonomy is working fine in admin.
Now I'm trying to create a template for categorycourses
at frontend that lists all coursecategories.
I've looked at the template hierarchy and I thought I should create a file with the taxonomy name categorycourses.php
So I created a file called categorycourses.php
in the themes folder. I also tried creating categorycourses-categorycourse.php
, archive-categorycourses.php
but I just keep getting a 404 error.
Please bare with me. I understand lot of backend-stuff in WP, but I'm just learning how to create templates at frontend.
I'm able to create archive-pages for certain post typs, so rewrites rules and so on are working on my local server.
What am I doing wrong?
UPDATE
1. I've tried to create a file name taxonomy-categorycourses.php
and with same result (404 error) I've flushed permalink-settings in admin by resaving them
I've also tried:
$course_cat_args = array(
'hierarchical' => true,
'labels' => $course_cat_labels,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'rewrite' => array('slug' => 'soup')
);
register_taxonomy( 'categorycourses', array('course'), $course_cat_args );
I try to access the template with http://server/soup
but still get the error. (after resaving permalink-settings in admin)
UPDATE2: *I think I've figured it out:* There don't seem to be any template for "root-taxonomy". You have to choose a specific coursecategory to act as a root.
In my case I've created this file:
taxonomy-categorycourses-semester2014.php
When I then access http://server/soup/semester2014
the expected template (taxonomy-categorycourses-semester2014.php
) is shown.
But there seems no way to actually create a "root template for a taxonomy" like http://server/soup/
. Even if I create a template called taxonomy-categorycourses.php
it does not work.
Is this correct?