-
Notifications
You must be signed in to change notification settings - Fork 0
/
cpt.php
48 lines (42 loc) · 1.29 KB
/
cpt.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
<?php
/**
* Generate Income CPT.
*
* @package charts
*/
function cptui_register_my_cpts_income() {
/**
* Post Type: Income.
*/
$labels = [
'name' => __( 'Income', 'vgs' ),
'singular_name' => __( 'Income', 'vgs' ),
'add_new' => __( 'Add Income', 'vgs' ),
'new_item' => __( 'New Income', 'vgs' ),
'view_item' => __( 'View Income', 'vgs' ),
];
$args = [
'label' => __( 'Income', 'vgs' ),
'labels' => $labels,
'description' => '',
'public' => false,
'publicly_queryable' => false,
'show_ui' => true,
'show_in_rest' => true,
'rest_base' => '',
'rest_controller_class' => 'WP_REST_Posts_Controller',
'has_archive' => false,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'delete_with_user' => false,
'exclude_from_search' => false,
'capability_type' => 'post',
'map_meta_cap' => true,
'hierarchical' => false,
'rewrite' => [ 'slug' => 'income', 'with_front' => true ],
'query_var' => true,
'supports' => [ 'title', 'editor', 'thumbnail' ],
];
register_post_type( 'income', $args );
}
add_action( 'init', 'cptui_register_my_cpts_income' );