//新增自定义文章类型:专题
function qui_class() {
register_post_type( 'series', //这里的work可以自行修改,主要体现在URL里面
array(
'labels' => array(
'name' => '专题',
'singular_name' => '所有专题',
'add_new' => '添加专题',
'add_new_item' => '添加新专题',
'edit' => '编辑',
'edit_item' => '编辑专题',
'new_item' => '新专题',
'view' => '查看专题',
'view_item' => '查看专题',
'search_items' => '搜索专题',
'not_found' => '没有找到相关专题',
'not_found_in_trash' => '没有专题评论',
'parent' => '专题评论',
),
'exclude_from_search'=>false,
'public' => true,
'menu_position' => 6,
'supports' => array( 'title', 'editor','comments', 'custom-fields','thumbnail','excerpt'), //为自定义文章添加标题,编辑器,评论,自定义字段,特色图像,摘要功能
'taxonomies' => array( '' ), //分类法,我们是单独定义
'has_archive' => true,
// 'taxonomies'=> array('post_tag'), //没有这一句是没有标签功能的
)
);
}
add_action( 'init', 'qui_class' ); //挂载函数
//为商品类自定义类型增加分类功能
add_action( 'init', 'qui_class_child', 0 );
function qui_class_child() {
register_taxonomy(
'series', //这个分类法
'series', //这个是自定义文章类型,默认文章是post,其他是你自己定义的
array(
'labels' => array(
'name' => '作品专题',
'add_new_item' => '添加专题',
'new_item_name' => "新专题分类"
),
'show_ui' => true,
'show_tagcloud' => true,
'hierarchical' => true,
)
);
}