I have created a new custom post type in wordpress using register_post_type()
function But when I click on add new in right side the editor not showing template choose option as you can see in Screenshot_01.png. In Screenshot_2 you can see the default add post option has the template choose option. How can I get that option without using plugin.
Here is my exiting code for creating custom post type.
function short_story_type(){
$labels = array(
'name' => _x( 'storys', 'Post Type General Name', 'textdomain' ),
'singular_name' => _x( 'story', 'Post Type Singular Name', 'textdomain' ),
'menu_name' => _x( 'storys', 'Admin Menu text', 'textdomain' ),
'name_admin_bar' => _x( 'story', 'Add New on Toolbar', 'textdomain' ),
'archives' => __( 'story Archives', 'textdomain' ),
'attributes' => __( 'story Attributes', 'textdomain' ),
'parent_item_colon' => __( 'Parent story:', 'textdomain' ),
'all_items' => __( 'All storys', 'textdomain' ),
'add_new_item' => __( 'Add New story', 'textdomain' ),
'add_new' => __( 'Add New', 'textdomain' ),
'new_item' => __( 'New story', 'textdomain' ),
'edit_item' => __( 'Edit story', 'textdomain' ),
'update_item' => __( 'Update story', 'textdomain' ),
'view_item' => __( 'View story', 'textdomain' ),
'view_items' => __( 'View storys', 'textdomain' ),
'search_items' => __( 'Search story', 'textdomain' ),
'not_found' => __( 'Not found', 'textdomain' ),
'not_found_in_trash' => __( 'Not found in Trash', 'textdomain' ),
'featured_image' => __( 'Featured Image', 'textdomain' ),
'set_featured_image' => __( 'Set featured image', 'textdomain' ),
'remove_featured_image' => __( 'Remove featured image', 'textdomain' ),
'use_featured_image' => __( 'Use as featured image', 'textdomain' ),
'insert_into_item' => __( 'Insert into story', 'textdomain' ),
'uploaded_to_this_item' => __( 'Uploaded to this story', 'textdomain' ),
'items_list' => __( 'storys list', 'textdomain' ),
'items_list_navigation' => __( 'storys list navigation', 'textdomain' ),
'filter_items_list' => __( 'Filter storys list', 'textdomain' ),
);
$args = array(
'label' => __( 'story', 'textdomain' ),
'description' => __( '', 'textdomain' ),
'labels' => $labels,
'menu_icon' => 'dashicons-album',
'supports' => array('title', 'editor', 'excerpt', 'thumbnail', 'revisions', 'author', 'comments', 'trackbacks', 'page-attributes', 'post-formats', 'custom-fields'),
'taxonomies' => array(),
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => true,
'hierarchical' => false,
'exclude_from_search' => true,
'show_in_rest' => true,
'publicly_queryable' => true,
'capability_type' => 'post',
);
register_post_type( 'story', $args );
}
add_action('init', 'short_story_type');