自定义帖子类型分类页面/模板
问题描述:
我创建了一个自定义帖子类型,它有一系列不同的类别,需要他们自己的登录页面。现在我已经通过WP Post Type Templates,但我仍然无法显示类别页面。眼下CPT类别页面只是404自定义帖子类型分类页面/模板
我试图做到以下几点:
- 注册后类型档案基于关闭this。
- 使用创建存档模板文件archive-teams.php和archive-team.php。
- 尝试使用category-teams.php和category-team.php。
- 刷新固定链接100万次。
这里是我如何注册后类型和分类:
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'),
)
);
}
答
你应该尝试archive- $ customposttype.php编辑档案文件,包括自定义文章类型类别的页面模板。你可以在这里阅读更多https://developer.wordpress.org/themes/basics/template-hierarchy/
你需要在这个.. –
你面临什么问题? –
@ Mr.HK类别模板不能正常工作/显示并得到一个404. – alexmattorr