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
|
function custom_post_type() {
$labels = array(
'name' => __( 'Books', 'textdomain' ),
'singular_name' => __( 'Book', 'textdomain' ),
'menu_name' => __( 'Books', 'textdomain' ),
'add_new' => __( 'Add New', 'textdomain' ),
'add_new_item' => __( 'Add New Book', 'textdomain' ),
'edit_item' => __( 'Edit Book', 'textdomain' ),
'new_item' => __( 'New Book', 'textdomain' ),
'view_item' => __( 'View Book', 'textdomain' ),
'search_items' => __( 'Search Books', 'textdomain' ),
'not_found' => __( 'No books found', 'textdomain' ),
'not_found_in_trash' => __( 'No books found in Trash', 'textdomain' ),
'parent_item_colon' => __( 'Parent Book:', 'textdomain' ),
'all_items' => __( 'All Books', 'textdomain' ),
'archives' => __( 'Book Archives', 'textdomain' ),
'attributes' => __( 'Book Attributes', 'textdomain' ),
'insert_into_item' => __( 'Insert into book', 'textdomain' ),
'uploaded_to_this_item' => __( 'Uploaded to this book', 'textdomain' ),
'featured_image' => _x( 'Featured Image', 'book', 'textdomain' ),
'set_featured_image' => _x( 'Set featured image', 'book', 'textdomain' ),
'remove_featured_image' => _x( 'Remove featured image', 'book', 'textdomain' ),
'use_featured_image' => _x( 'Use as featured image', 'book', 'textdomain' ),
'filter_items_list' => __( 'Filter books list', 'textdomain' ),
'items_list_navigation' => __( 'Books list navigation', 'textdomain' ),
'items_list' => __( 'Books list', 'textdomain' ),
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'book' ),
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => false,
'menu_position' => 5,
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' ),
);
register_post_type( 'book', $args );
}
add_action( 'init', 'custom_post_type' );
|