-
Notifications
You must be signed in to change notification settings - Fork 6
/
custom-post-type.sublime-snippet
59 lines (51 loc) · 2.35 KB
/
custom-post-type.sublime-snippet
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
<snippet>
<content><![CDATA[
add_action( 'init', 'register_cpt_${1:name}' );
function register_cpt_${1:name}() {
\$labels = array(
'name' => __( '${2:Name of plural post type}', '${3:domain}' ),
'singular_name' => __( '${4:Name of singular post type}', '${3:domain}' ),
'add_new' => _x( 'Add New ${4:Name of singular post type}', '${4:Name}', '${3:domain}' ),
'add_new_item' => __( 'Add New ${4:Name of singular post type}', '${3:domain}' ),
'edit_item' => __( 'Edit ${4:Name of singular post type}', '${3:domain}' ),
'new_item' => __( 'New ${4:Name of singular post type}', '${3:domain}' ),
'view_item' => __( 'View ${4:Name of singular post type}', '${3:domain}' ),
'search_items' => __( 'Search ${2:Name of plural post type}', '${3:domain}' ),
'not_found' => __( 'No ${2:Name of plural post type} found', '${3:domain}' ),
'not_found_in_trash' => __( 'No ${2:Name of plural post type} found in Trash', '${3:domain}' ),
'parent_item_colon' => __( 'Parent ${4:Name of singular post type}:', '${3:domain}' ),
'menu_name' => __( '${2:Name of plural post type}', '${3:domain}' ),
);
\$args = array(
'labels' => \$labels,
'hierarchical' => true,
'description' => 'description',
'taxonomies' => array( 'category' ),
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
//'menu_icon' => '',
'show_in_nav_menus' => true,
'publicly_queryable' => true,
'exclude_from_search' => false,
'has_archive' => true,
'query_var' => true,
'can_export' => true,
'rewrite' => true,
'capability_type' => 'post',
'supports' => array(
'title', 'editor', 'author', 'thumbnail',
'custom-fields', 'trackbacks', 'comments',
'revisions', 'page-attributes', 'post-formats'
),
);
register_post_type( '${1:test}', \$args );
}
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>cpt</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<!-- Optional: Description to show in the menu -->
<description>Register Custom Post Type Wordpress</description>
</snippet>