我很难理解为什么知识库和文章中没有出现类别。这个代码怎么了?
<?php
// Custom post types
/* faq */
add_action( \'init\', \'faq_post_type\' );
if ( ! function_exists( \'faq_post_type\' ) ) {
function faq_post_type() {
//Register FAQ Post Type
register_post_type( \'faq\',
array(
\'description\' => __( \'FAQ Articles\', \'guerilla\' ),
\'labels\' => array(
\'name\' => __( \'FAQ\', \'guerilla\' ),
\'singular_name\' => __( \'FAQ\', \'guerilla\' ),
\'add_new\' => __(\'Add New\', \'guerilla\'),
\'add_new_item\' => __(\'Add New FAQ\', \'guerilla\'),
\'edit_item\' => __(\'Edit FAQ\', \'guerilla\'),
\'new_item\' => __(\'New FAQ\', \'guerilla\'),
\'view_item\' => __(\'View FAQ\', \'guerilla\'),
\'search_items\' => __(\'Search FAQ\', \'guerilla\'),
\'not_found\' => __(\'No FAQ found\', \'guerilla\'),
\'not_found_in_trash\' => __(\'No FAQ found in Trash\', \'guerilla\')
),
\'public\' => true,
\'menu_position\' => 7,
\'rewrite\' => array(\'slug\' => \'faq\'),
\'supports\' => array(
\'title\',
\'editor\'),
\'public\' => true,
\'show_ui\' => true,
\'publicly_queryable\' => true,
\'exclude_from_search\' => false
)
);
}
}
function faq_taxonomy()
{
$labels = array(\'name\' => __( \'Categories\', \'guerilla\' ),
\'singular_name\' => __( \'Category\', \'guerilla\' ),
\'search_items\' => __( \'Search Categories\', \'guerilla\' ),
\'all_items\' => __( \'All Categories\', \'guerilla\' ),
\'parent_item\' => __( \'Parent Category\', \'guerilla\' ),
\'parent_item_colon\' => __( \'Parent Category:\', \'guerilla\' ),
\'edit_item\' => __( \'Edit Category\', \'guerilla\' ),
\'update_item\' => __( \'Update Category\', \'guerilla\' ),
\'add_new_item\' => __( \'Add New Category\', \'guerilla\' ),
\'new_item_name\' => __( \'New Category Name\', \'guerilla\' ),
\'menu_name\' => __( \'Categories\', \'guerilla\' ) );
register_taxonomy( \'faq_category\',
array( \'faq\' ),
array( \'hierarchical\' => true,
\'labels\' => $labels,
\'show_ui\' => true,
\'public\' => true,
\'query_var\' => true,
\'rewrite\' => array( \'slug\' => \'faq_category\' )));
}
add_action( \'init\', \'faq_taxonomy\' );
/* Knowledgebase*/
add_action( \'init\', \'KnowledgeBase_post_type\' );
if ( ! function_exists( \'KnowledgeBase_post_type\' ) ) {
function KnowledgeBase_post_type() {
register_post_type( \'KnowledgeBase\',
array(
\'description\' => __( \'KnowledgeBase Articles\', \'guerilla\' ),
\'labels\' => array(
\'name\' => __( \'KnowledgeBase\', \'guerilla\' ),
\'singular_name\' => __( \'KnowledgeBase\', \'guerilla\' ),
\'add_new\' => __(\'Add New\', \'guerilla\'),
\'add_new_item\' => __(\'Add New KnowledgeBase Articles\', \'guerilla\'),
\'edit_item\' => __(\'Edit KnowledgeBase Articles\', \'guerilla\'),
\'new_item\' => __(\'New KnowledgeBase Articles\', \'guerilla\'),
\'view_item\' => __(\'View KnowledgeBase Articles\', \'guerilla\'),
\'search_items\' => __(\'Search KnowledgeBase Articles\', \'guerilla\'),
\'not_found\' => __(\'No KnowledgeBase Articles found\', \'guerilla\'),
\'not_found_in_trash\' => __(\'No KnowledgeBase Articles found in Trash\', \'guerilla\')
),
\'public\' => true,
\'menu_position\' => 5,
\'rewrite\' => array(\'slug\' => \'KnowledgeBase\'),
\'supports\' => array(
\'title\',
\'editor\'),
\'public\' => true,
\'show_ui\' => true,
\'publicly_queryable\' => true,
\'exclude_from_search\' => false
)
);
}
}
function KnowledgeBase_taxonomy()
{
$labels = array(\'name\' => __( \'Categories\', \'guerilla\' ),
\'singular_name\' => __( \'Category\', \'guerilla\' ),
\'search_items\' => __( \'Search Categories\', \'guerilla\' ),
\'all_items\' => __( \'All Categories\', \'guerilla\' ),
\'parent_item\' => __( \'Parent Category\', \'guerilla\' ),
\'parent_item_colon\' => __( \'Parent Category:\', \'guerilla\' ),
\'edit_item\' => __( \'Edit Category\', \'guerilla\' ),
\'update_item\' => __( \'Update Category\', \'guerilla\' ),
\'add_new_item\' => __( \'Add New Category\', \'guerilla\' ),
\'new_item_name\' => __( \'New Category Name\', \'guerilla\' ),
\'menu_name\' => __( \'Categories\', \'guerilla\' ) );
register_taxonomy( \'KnowledgeBase_category\',
array( \'KnowledgeBase\' ),
array( \'hierarchical\' => true,
\'labels\' => $labels,
\'show_ui\' => true,
\'public\' => true,
\'query_var\' => true,
\'rewrite\' => array( \'slug\' => \'KnowledgeBase_category\' )));
}
add_action( \'init\', \'KnowledgeBase_taxonomy\' );
/* Articles */
add_action( \'init\', \'Articles_post_type\' );
if ( ! function_exists( \'Articles_post_type\' ) ) {
function Articles_post_type() {
//Register FAQ Post Type
register_post_type( \'Articles\',
array(
\'description\' => __( \'Articles\', \'guerilla\' ),
\'labels\' => array(
\'name\' => __( \'Articles\', \'guerilla\' ),
\'singular_name\' => __( \'Articles\', \'guerilla\' ),
\'add_new\' => __(\'Add New\', \'guerilla\'),
\'add_new_item\' => __(\'Add New Articles\', \'guerilla\'),
\'edit_item\' => __(\'Edit Articles\', \'guerilla\'),
\'new_item\' => __(\'New Articles\', \'guerilla\'),
\'view_item\' => __(\'View Articles\', \'guerilla\'),
\'search_items\' => __(\'Search Articles\', \'guerilla\'),
\'not_found\' => __(\'No Articles found\', \'guerilla\'),
\'not_found_in_trash\' => __(\'No Articles found in Trash\', \'guerilla\')
),
\'public\' => true,
\'menu_position\' => 6,
\'rewrite\' => array(\'slug\' => \'Articles\'),
\'supports\' => array(
\'title\',
\'editor\'),
\'public\' => true,
\'show_ui\' => true,
\'publicly_queryable\' => true,
\'exclude_from_search\' => false
)
);
}
}
function Articles_taxonomy()
{
$labels = array(\'name\' => __( \'Categories\', \'guerilla\' ),
\'singular_name\' => __( \'Category\', \'guerilla\' ),
\'search_items\' => __( \'Search Categories\', \'guerilla\' ),
\'all_items\' => __( \'All Categories\', \'guerilla\' ),
\'parent_item\' => __( \'Parent Category\', \'guerilla\' ),
\'parent_item_colon\' => __( \'Parent Category:\', \'guerilla\' ),
\'edit_item\' => __( \'Edit Category\', \'guerilla\' ),
\'update_item\' => __( \'Update Category\', \'guerilla\' ),
\'add_new_item\' => __( \'Add New Category\', \'guerilla\' ),
\'new_item_name\' => __( \'New Category Name\', \'guerilla\' ),
\'menu_name\' => __( \'Categories\', \'guerilla\' ) );
register_taxonomy( \'Article_category\',
array( \'Articles\' ),
array( \'hierarchical\' => true,
\'labels\' => $labels,
\'show_ui\' => true,
\'public\' => true,
\'query_var\' => true,
\'rewrite\' => array( \'slug\' => \'Article_category\' )));
}
add_action( \'init\', \'Articles_taxonomy\' );