This repository has been archived by the owner on Nov 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtemplate-portfolio.php
63 lines (62 loc) · 1.8 KB
/
template-portfolio.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
function post_type_work() {
register_post_type(
'work',
array( 'public' => true,
'publicly_queryable' => true,
'hierarchical' => false,
'labels'=>array(
'name' => _x('作品', 'post type general name'),
'singular_name' => _x('作品', 'post type singular name'),
'add_new' => _x('添加新作品', '作品'),
'add_new_item' => __('添加新作品'),
'edit_item' => __('编辑作品'),
'new_item' => __('新的作品'),
'view_item' => __('预览作品'),
'search_items' => __('搜索作品'),
'not_found' => __('您还没有发布作品'),
'not_found_in_trash' => __('回收站中没有作品'),
'parent_item_colon' => ''
),
'show_ui' => true,
'menu_position'=>5,
'supports' => array(
'title',
'author',
'excerpt',
'thumbnail',
'trackbacks',
'editor',
'comments',
'custom-fields',
'revisions' ) ,
'show_in_nav_menus' => true ,
'taxonomies' => array(
'menutype')
)
);
}
add_action('init', 'post_type_work');
function create_genre_taxonomy() {
$labels = array(
'name' => _x( '作品分类', 'taxonomy general name' ),
'singular_name' => _x( 'genre', 'taxonomy singular name' ),
'search_items' => __( '搜索分类' ),
'all_items' => __( '全部分类' ),
'parent_item' => __( '父级分类目录' ),
'parent_item_colon' => __( '父级分类目录:' ),
'edit_item' => __( '编辑作品分类' ),
'update_item' => __( '更新' ),
'add_new_item' => __( '添加新作品分类' ),
'new_item_name' => __( 'New Genre Name' ),
);
register_taxonomy('genre',array('work'), array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'genre' ),
));
}
add_action( 'init', 'create_genre_taxonomy', 0 );
?>