I have a custom post type, course
with an associated custom taxonomy curriculum-area
. On the permalink domain.com/course/
, a list of all courses is shown as expected. However, on the permalink domain.com/curriculum-area/equality
, it shows the home page. (The home page is a static page). I would like it to, instead, show an archive of all courses
in the specified curriculum-area
: equality
. Also, if I have a front-page.php
, this archive page also uses the template from front-page.php
.
How can I get the archive.php
template to be applied to this custom taxonomy?
// functions.php:
<?php
// add thumbnail support
add_theme_support( 'post-thumbnails' );
// add custom post type 'Course'
add_action( 'init', 'register_cpt_course' );
function register_cpt_course() {
// custom taxonomy - curriculum area
$args_curriculum_area_taxonomy = array(
'hierarchical' => true,
'labels' => array(
'name' => 'Curriculum Areas',
'singular_name' => 'Curriculum Area'
),
'show_ui' => true,
'show_admin_column' => true,
'update_count_callback' => '_update_post_term_count',
'query_var' => true,
'rewrite' => true
);
register_taxonomy( 'Curriculum Area', 'course', $args_curriculum_area_taxonomy );
// custom post type - course
$cpt_course_args = array(
'labels' => array(
'name' => 'Courses',
'singular_name' => 'course'
),
'hierarchical' => false,
'description' => 'The place to display courses',
'supports' => array( 'title', 'editor', 'thumbnail', 'custom-fields', 'revisions' ),
'taxonomies' => array( 'curriculum_area' ),
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'show_in_nav_menus' => true,
'publicly_queryable' => true,
'exclude_from_search' => false,
'has_archive' => true,
'query_var' => true,
'can_export' => true,
'rewrite' => array(
'slug' => 'course',
'with_front' => true
),
'capability_type' => 'post'
);
register_post_type( 'course', $cpt_course_args );
}
?>