How to make custom pages for custom post types

So I made a custom post type for my wordpress site using this code:

add_action( 'init', 'register_cpt_bingo' );

function register_cpt_bingo() {

    $labels = array( 
        'name' => _x( 'Bingo Sites', 'bingo' ),
        'singular_name' => _x( 'Bingo', 'bingo' ),
        'add_new' => _x( 'Add New', 'bingo' ),
        'add_new_item' => _x( 'Add New Bingo Site', 'bingo' ),
        'edit_item' => _x( 'Edit Bingo', 'bingo' ),
        'new_item' => _x( 'New Bingo', 'bingo' ),
        'view_item' => _x( 'View Bingo Site', 'bingo' ),
        'search_items' => _x( 'Search Bingo Sites', 'bingo' ),
        'not_found' => _x( 'No bingo sites found', 'bingo' ),
        'not_found_in_trash' => _x( 'No bingo sites found in Trash', 'bingo' ),
        'parent_item_colon' => _x( 'Parent Bingo:', 'bingo' ),
        'menu_name' => _x( 'Bingo Sites', 'bingo' ),
    );

    $args = array( 
        'labels' => $labels,
        'hierarchical' => true,

        'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'page-attributes' ),

        'public' => true,
        'show_ui' => true,
        'show_in_menu' => true,

        'menu_icon' => '/wp-content/themes/gamblingq/img/bingo.png',
        'show_in_nav_menus' => true,
        'publicly_queryable' => true,
        'exclude_from_search' => false,
        'has_archive' => true,
        'query_var' => true,
        'can_export' => true,
        'rewrite' => true,
        'capability_type' => 'page'
    );

    register_post_type( 'bingo', $args );
}

It works perfectly. This is a screen from my admin panel:

Read More

enter image description here

How can I add the option to select a custom page template same as in the following picture:

enter image description here

Any advice is helpful! Thanks!

Related posts

Leave a Reply

1 comment