如何给自定义分类增加tags
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 2…
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
|
register_post_type( ‘interviewdoctor’,
array(
‘labels’ => array (
‘name’ => ‘InterView’,
‘singular_name’ => ‘InterView’,
‘add_new’ => ‘Add InterView’,
‘add_new_item’ => ‘Add InterView’,
‘edit’ => ‘Edit InterView’,
‘edit_item’ => ‘Edit InterView’,
‘new_item’ => ‘Add InterView’,
‘view’ => ‘Edit InterView’,
‘view_item’ => ‘Show InterView’,
‘search_items’ => ‘Search’,
‘not_found’ => ‘Not Found’,
),
‘_builtin’ => false,
‘taxonomies’ => array(‘interviewdoctor’, ‘post_tag’),
‘public’ => true,
‘show_ui’ => true,
‘show_in_nav_menus’ => true,
‘menu_position’ => 5 ,
‘hierarchical’ => true,
‘has_archive’ => true,
‘capability_type’ => ‘page’,
‘menu_icon’ => ‘https://cdn1.iconfinder.com/data/icons/free-game-icons/32/Doctor.png’,
‘rewrite’ => array(
‘slug’ => ‘interviewdoctor’,
‘with_front’ => false,
‘pages’ => true
),
‘supports’ => array(
‘title’,
‘thumbnail’,
‘editor’,
‘date’,
‘excerpt’,
‘comments’,
‘custom-fields’,
‘tags’)
)
);
}
add_action(‘init’, ‘interviewdoctor’);
|
或者直接
1
|
‘taxonomies’ => array(‘post_tag’)
|
An array of registered taxonomies like
category
orpost_tag
that will be used with this post type. This can be used in lieu of callingregister_taxonomy_for_object_type()
directly. Custom taxonomies still need to be registered withregister_taxonomy()
.
to the $args
array in the functions.php
-file where you create the custom post type with register_post_type()
.
类别:WordPress开发、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。
评论功能已经关闭!