CH Book
if ( ! function_exists('ch_books') ) {
// Register Custom Post Type
function ch_books() {
$labels = array(
'name' => _x( 'Raamatut', 'Post Type General Name', 'ch_posttypes' ),
'singular_name' => _x( 'Raamat', 'Post Type Singular Name', 'ch_posttypes' ),
'menu_name' => __( 'Raamatud', 'ch_posttypes' ),
'name_admin_bar' => __( 'Raamatut', 'ch_posttypes' ),
'archives' => __( 'Arhiivis', 'ch_posttypes' ),
'attributes' => __( 'Seaded', 'ch_posttypes' ),
'parent_item_colon' => __( 'Põhiraamat', 'ch_posttypes' ),
'all_items' => __( 'Kõik ülevaated', 'ch_posttypes' ),
'add_new_item' => __( 'Lisa ülevaade', 'ch_posttypes' ),
'add_new' => __( 'Lisa ülevaade', 'ch_posttypes' ),
'new_item' => __( 'Uus ülevaade', 'ch_posttypes' ),
'edit_item' => __( 'Muuda ülevaadet', 'ch_posttypes' ),
'update_item' => __( 'Uuenda ülevaadet', 'ch_posttypes' ),
'view_item' => __( 'Vaata ülevaadet', 'ch_posttypes' ),
'view_items' => __( 'Vaata ülevaateid', 'ch_posttypes' ),
'search_items' => __( 'Otsi ülevaadet', 'ch_posttypes' ),
'not_found' => __( 'Ei leidnud', 'ch_posttypes' ),
'not_found_in_trash' => __( 'Ei leidnud prügist', 'ch_posttypes' ),
'featured_image' => __( 'Kaanepilt', 'ch_posttypes' ),
'set_featured_image' => __( 'Lisa kaanepilt', 'ch_posttypes' ),
'remove_featured_image' => __( 'Eemalda kaanepilt', 'ch_posttypes' ),
'use_featured_image' => __( 'Kasuta kaanepildina', 'ch_posttypes' ),
'insert_into_item' => __( 'Lisa', 'ch_posttypes' ),
'uploaded_to_this_item' => __( 'Lisatud', 'ch_posttypes' ),
'items_list' => __( 'Items list', 'ch_posttypes' ),
'items_list_navigation' => __( 'Items list navigation', 'ch_posttypes' ),
'filter_items_list' => __( 'Filter items list', 'ch_posttypes' ),
);
$rewrite = array(
'slug' => 'raamatud',
'with_front' => true,
'pages' => true,
'feeds' => true,
);
$capabilities = array(
'edit_post' => 'edit_book',
'read_post' => 'read_book',
'delete_post' => 'delete_book',
'edit_posts' => 'edit_books',
'edit_others_posts' => 'edit_others_books',
'publish_posts' => 'publish_books',
'read_private_posts' => 'read_private_books',
);
$args = array(
'label' => __( 'Raamat', 'ch_posttypes' ),
'description' => __( 'Raamatud', 'ch_posttypes' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'thumbnail', 'comments', 'trackbacks', 'revisions', 'page-attributes' ),
'taxonomies' => array( 'category', 'post_tag' ),
'hierarchical' => true,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 20,
'menu_icon' => 'dashicons-book-alt',
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => false,
'exclude_from_search' => false,
'publicly_queryable' => true,
'rewrite' => $rewrite,
'capabilities' => $capabilities,
'show_in_rest' => false,
'rest_base' => 'books',
);
register_post_type( 'book', $args );
}
add_action( 'init', 'ch_books', 0 );
}