这是我在本地测试的内容,它显示了您在设置页面中创建的分类类型名称,代码添加到分类归档页面上的permalink中。
add_action( \'init\', \'wpsites_create_custom_taxonomy_types\' );
function wpsites_create_custom_taxonomy_types() {
register_taxonomy( \'system-type\', \'system\',
array(
\'labels\' => array(
\'name\' => _x( \'Types\', \'taxonomy general name\', \'wpsites\' ),
\'add_new_item\' => __( \'Add New System Type\', \'wpsites\' ),
\'new_item_name\' => __( \'New System Type\', \'wpsites\' ),
),
\'exclude_from_search\' => true,
\'has_archive\' => true,
\'hierarchical\' => true,
\'rewrite\' => array( \'slug\' => \'system-type\', \'with_front\' => false ),
\'show_ui\' => true,
\'show_tagcloud\' => false,
));
}
add_action( \'init\', \'wpsites_system_custom_post_type\' );
function wpsites_system_custom_post_type() {
register_post_type( \'system\',
array(
\'labels\' => array(
\'name\' => __( \'System\', \'wpsites\' ),
\'singular_name\' => __( \'System\', \'wpsites\' ),
),
\'has_archive\' => true,
\'hierarchical\' => true,
\'menu_icon\' => \'dashicons-admin-network\',
\'public\' => true,
\'rewrite\' => array( \'slug\' => \'system\', \'with_front\' => false ),
\'supports\' => array( \'title\', \'editor\', \'author\', \'thumbnail\', \'excerpt\', \'trackbacks\', \'custom-fields\', \'revisions\', \'page-attributes\' ),
\'taxonomies\' => array( \'system-type\' ),
));
}