I have created a Custom Post Type that has a series of different categories that need their own landing page. Right now I have gone through WP Post Type Templates but I still cannot get the category page to show up. Right now the CPT category pages just 404.
I have tried to do the following:
Here is how I am registering the post type and taxonomy:
add_action('init', 'create_team');
function create_team() {
register_taxonomy(
'teams',
array(),
array(
'hierarchical' => true,
'labels' => array
(
'name' => _x('Teams', 'taxonomy general name'),
'singular_name' => _x('Team', 'taxonomy singular name')
),
'show_ui' => true,
'show_admin_column' => true,
'query_var' => 'team',
'rewrite' => array(
'slug' => 'our-team',
),
)
);
register_post_type(
'team',
array(
'labels' => array
(
'name' => _x('Team Members', 'post type general name'),
'singular_name' => _x('Team Member', 'post type singular name')
),
'supports' => array('title', 'editor', 'thumbnail'),
'public' => true,
'rewrite' => array
(
'slug' => 'our-team/%teams%',
'with_front' => false
),
'query_var' => 'team',
'has_archive' => 'team',
'taxonomies' => array( 'teams','category','post_tag' ),
)
);
}
You should try archive-$customposttype.php for editing the archive file, including category page template for custom post types. You can read more here https://developer.wordpress.org/themes/basics/template-hierarchy/