[英]Custom Post Type Category subpage
Okay, so I have created a new custom post type, named sectors, and a sub category for this, named categories. 好的,所以我创建了一个新的自定义帖子类型,命名为扇区,并为此创建了一个子类别,命名为类别。
add_action( 'init', 'create_sector_cat' );
function create_sector_cat() {
register_taxonomy(
'SectorCategories',
'sectors',
array(
'label' => __( 'Sector Categories' ),
'rewrite' => array( 'slug' => 'sectorcategories' ),
'hierarchical' => true,
)
);
}
Now, when I press sector categories, it shows all categories which are created, using a file named sectorcategories.php 现在,当我按扇区类别时,它将使用名为ectorcategories.php的文件显示所有已创建的类别。
I then will have different 'products' inside this category, and I understand the filename should be taxonomy-sectorcategories.php, but this file isnt working? 然后,我将在此类别中使用不同的“产品”,并且我知道文件名应为taxonomy-sectorcategories.php,但此文件不起作用吗?
The first parameter is the taxonomy name. 第一个参数是分类名称。 and according to the Wordpress codex it should only contain lowercase letters and the underscore character.
根据Wordpress Codex,它只能包含小写字母和下划线字符。 Read more
阅读更多
I see you have a capital letter in your taxonomy name and that might be the problem. 我看到您的分类名称中有一个大写字母,这可能是问题所在。 I could be wrong but I have run into trouble with this as well, i think it is very case sensitive.
我可能是错的,但是我也遇到了麻烦,我认为这是区分大小写的。
ps: I know this answer comes late but it if it works it might still help someone else. ps:我知道这个答案来晚了,但是如果成功了,它可能仍然可以帮助其他人。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.