希望这能解决你的问题
function my_custom_post_type() {
$labels = array(
\'name\' => _x(\'Projects\', \'post type general name\'),
\'singular_name\' => _x(\'Project\', \'post type singular name\'),
\'add_new\' => _x(\'Add New\', \'project item\'),
\'add_new_item\' => __(\'Add New Project\'),
\'edit_item\' => __(\'Edit Project\'),
\'new_item\' => __(\'New Project\'),
\'view_item\' => __(\'View Project\'),
\'search_items\' => __(\'Search Projects\'),
\'not_found\' => __(\'Nothing found\'),
\'not_found_in_trash\' => __(\'Nothing found in Trash\'),
\'parent_item_colon\' => \'\',
\'menu_name\' => \'Projects\'
);
$args = array(
\'labels\' => $labels,
\'public\' => true,
\'publicly_queryable\' => true,
\'hierarchical\' => false,
\'has_archive\' => true,
\'rewrite\' => array(\'slug\'=>\'work\', \'with_front\'=>false),
\'show_ui\' => true,
\'_builtin\' => false, // It\'s a custom post type, not built in!
\'capability_type\' => \'post\',
\'query_var\' => true, // This goes to the WP_Query schema
\'menu_position\' => null,
\'supports\' => array(\'title\',\'editor\',\'thumbnail\', \'comments\', \'author\', \'excerpt\')
);
register_post_type( \'work\' , $args );
}
function my_custom_taxonomies() {
$labels = array(
\'name\' => __( \'Taxonomy\', \'taxonomy general name\' ),
\'singular_name\' => __( \'Taxonomy\', \'taxonomy singular name\' ),
\'search_items\' => __( \'Search Taxonomy\' ),
\'all_items\' => __( \'All Taxonomy\' ),
\'parent_item\' => __( \'Parent Taxonomy\' ),
\'parent_item_colon\' => __( \'Parent Taxonomy:\' ),
\'edit_item\' => __( \'Edit Taxonomy\' ),
\'update_item\' => __( \'Update Taxonomy\' ),
\'add_new_item\' => __( \'Add New Taxonomy\' ),
\'new_item_name\' => __( \'New Taxonomy Name\' ),
\'menu_name\' => __( \'Taxonomy\' ),
);
register_taxonomy( \'taxonomy\', array(\'work\'), array (
\'labels\' => $labels,
\'hierarchical\' =>false,
\'show_ui\' => true,
\'rewrite\' => array( \'slug\' => \'work/taxonomy\'),
\'query_var\' => true,
\'show_in_nav_menus\' => true,
\'public\' => true,
));
}
add_action(\'init\', \'my_custom_post_type\', 0);
add_action(\'init\', \'my_custom_taxonomies\', 10);
您需要创建的是归档工作。php(您的帖子类型存档)和分类法。php,用于显示自定义分类法归档。