我似乎无法使存档页或类别页正常工作。
我正在跟踪http://codex.wordpress.org/Template_Hierarchy#Category_display
它仍然默认为归档。php(我认为,根据图表),尽管我已经将其命名为业务类别。php
这是我的代码:
/******************
// Business
******************/
function my_custom_post_business() {
$labels = array(
\'name\' => _x( \'business\', \'post type general name\' ),
\'singular_name\' => _x( \'business\', \'post type singular name\' ),
\'add_new\' => _x( \'Add New\', \'book\' ),
\'add_new_item\' => __( \'Add New business\' ),
\'edit_item\' => __( \'Edit business\' ),
\'new_item\' => __( \'New business\' ),
\'all_items\' => __( \'All business\' ),
\'view_item\' => __( \'View business\' ),
\'search_items\' => __( \'Search business\' ),
\'not_found\' => __( \'No business found\' ),
\'not_found_in_trash\' => __( \'No business found in the Trash\' ),
\'parent_item_colon\' => \'\',
\'menu_name\' => \'business\'
);
$args = array(
\'labels\' => $labels,
\'description\' => \'Holds our business and business specific data\',
\'public\' => true,
\'hierarchical\' => true,
\'show_ui\' => true,
\'show_in_nav_menus\' => true,
\'menu_position\' => 5,
\'supports\' => array( \'title\', \'editor\', \'thumbnail\', \'excerpt\', \'comments\' ),
\'has_archive\' => true,
//\'taxonomies\' => array(\'category\'),
);
register_post_type( \'business\', $args );
}
add_action( \'init\', \'my_custom_post_business\' );
/** add categories for custom post type */
add_action( \'init\', \'build_taxonomies\', 0 );
function build_taxonomies() {
register_taxonomy( \'mycategories\', \'business\', array( \'hierarchical\' => true, \'label\' => \'Business Categories\', \'query_var\' => true, \'rewrite\' => true ) );
}