Custom Post type for wordpress using code

https://www.wpbeginner.com/wp-tutorials/how-to-create-custom-post-types-in-wordpress/

Place the following code in function.php in theme

//yang added items
// Our custom post type function
function create_posttype() {

    register_post_type( 'coinObject',
    // CPT Options
        array(
            'labels' => array(
                'name' => __( 'CoinObjects' ),
                'singular_name' => __( 'CoinObject' )
            ),
            'public' => true,
            'has_archive' => true,
            'rewrite' => array('slug' => 'coinobjects'),
            'show_in_rest' => true,

        )
    );
}

/*
* Creating a function to create our CPT
*/

function custom_post_type() {

// Set UI labels for Custom Post Type
    $labels = array(
        'name'                => _x( 'CoinObjects', 'Post Type General Name', 'twentytwenty' ),
        'singular_name'       => _x( 'CoinObject', 'Post Type Singular Name', 'twentytwenty' ),
        'menu_name'           => __( 'CoinObjects', 'twentytwenty' ),
        'parent_item_colon'   => __( 'Parent CoinObject', 'twentytwenty' ),
        'all_items'           => __( 'All CoinObjects', 'twentytwenty' ),
        'view_item'           => __( 'View CoinObject', 'twentytwenty' ),
        'add_new_item'        => __( 'Add New CoinObject', 'twentytwenty' ),
        'add_new'             => __( 'Add New', 'twentytwenty' ),
        'edit_item'           => __( 'Edit CoinObject', 'twentytwenty' ),
        'update_item'         => __( 'Update CoinObject', 'twentytwenty' ),
        'search_items'        => __( 'Search CoinObject', 'twentytwenty' ),
        'not_found'           => __( 'Not Found', 'twentytwenty' ),
        'not_found_in_trash'  => __( 'Not found in Trash', 'twentytwenty' ),
    );

// Set other options for Custom Post Type

    $args = array(
        'label'               => __( 'CoinObjects', 'twentytwenty' ),
        'description'         => __( 'Object that gives coins', 'twentytwenty' ),
        'labels'              => $labels,
        // Features this CPT supports in Post Editor
        'supports'            => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'revisions', 'custom-fields', ),
        // You can associate this CPT with a taxonomy or custom taxonomy.
        'taxonomies'          => array( 'genres' ),
        /* A hierarchical CPT is like Pages and can have
        * Parent and child items. A non-hierarchical CPT
        * is like Posts.
        */
        'hierarchical'        => false,
        'public'              => true,
        'show_ui'             => true,
        'show_in_menu'        => true,
        'show_in_nav_menus'   => true,
        'show_in_admin_bar'   => true,
        'menu_position'       => 5,
        'can_export'          => true,
        'has_archive'         => true,
        'exclude_from_search' => false,
        'publicly_queryable'  => true,
        'capability_type'     => 'post',
        'show_in_rest' => true,

    );

    // Registering your Custom Post Type
    register_post_type( 'CoinObjects', $args );

}