// Add custom post type
function rp_books_register_post_type() {
//UI Visible labels
$labels = array(
'name' => __( 'Books', 'rp' ),
'singular_name' => __( 'Book', 'rp' ),
'add_new' => __( 'New Book', 'rp' ),
'add_new_item' => __( 'Add New Book', 'rp' ),
'edit_item' => __( 'Edit Book', 'rp' ),
'new_item' => __( 'New Book', 'rp' ),
'view_item' => __( 'View Book', 'rp' ),
'search_items' => __( 'Search Books', 'rp' ),
'not_found' => __( 'No Books Found', 'rp' ),
'not_found_in_trash' => __( 'No Books Found in Trash', 'rp' ),
);
// Post functionality
$args = array(
'labels' => $labels,
'has_archive' => 'books',
//'has_archive' => true,
'menu_icon' => 'dashicons-dashboard',
'public' => true,
'hierarchical' => false,
'supports' => array(
'title',
'editor',
'excerpt',
'custom-fields',
'thumbnail',
'page-attributes'
),
//'taxonomies' => 'category',
'rewrite' => array( 'slug' => 'book' ),
'show_in_rest' => true
//false by default:
//'show_admin_column' => true,
);
register_post_type( 'rp_book', $args );
}
add_action( 'init', 'rp_books_register_post_type' );