Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Products CPT

Originally created for Blue Cord Firearms

// Register Custom Post Type
function chroma_products_cpt() {

	$labels = array(
		'name'                  => 'Products',
		'singular_name'         => 'Product',
		'menu_name'             => '',
		'name_admin_bar'        => '',
		'archives'              => 'Product Archives',
		'parent_item_colon'     => 'Parent Product:',
		'all_items'             => 'All items',
		'add_new_item'          => 'Add New Item',
		'add_new'               => '',
		'new_item'              => 'New Item',
		'edit_item'             => 'Edit Item',
		'update_item'           => '',
		'view_item'             => 'View Item',
		'search_items'          => 'Search Items',
		'not_found'             => 'Not found',
		'not_found_in_trash'    => 'Not found in Trash',
		'featured_image'        => '',
		'set_featured_image'    => '',
		'remove_featured_image' => '',
		'use_featured_image'    => '',
		'insert_into_item'      => '',
		'uploaded_to_this_item' => '',
		'items_list'            => '',
		'items_list_navigation' => '',
		'filter_items_list'     => 'Filter items',
	);
	$args = array(
		'label'                 => 'Product',
		'description'           => 'Products for sale',
		'labels'                => $labels,
		'supports'              => array( 'title', 'editor', 'thumbnail', 'revisions', 'page-attributes', ),
		'hierarchical'          => true,
		'public'                => true,
		'show_ui'               => true,
		'show_in_menu'          => true,
		'menu_position'         => 20,
		'menu_icon'             => 'dashicons-cart',
		'show_in_admin_bar'     => true,
		'show_in_nav_menus'     => true,
		'can_export'            => true,
		'has_archive'           => true,		
		'exclude_from_search'   => false,
		'publicly_queryable'    => true,
		'capability_type'       => 'page',
	);
	register_post_type( 'item', $args );

}
add_action( 'init', 'chroma_products_cpt', 0 );