Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

AE Spink – Products

// Register Custom Post Type
function custom_post_type_products() {

	$labels = array(
		'name'                  => _x( 'Products', 'Post Type General Name', '_themename' ),
		'singular_name'         => _x( 'Product', 'Post Type Singular Name', '_themename' ),
		'menu_name'             => __( 'Products', '_themename' ),
		'name_admin_bar'        => __( 'Product', '_themename' ),
		'archives'              => __( 'Product Archives', '_themename' ),
		'attributes'            => __( 'Product Attributes', '_themename' ),
		'parent_item_colon'     => __( 'Parent Product:', '_themename' ),
		'all_items'             => __( 'All Products', '_themename' ),
		'add_new_item'          => __( 'Add New Product', '_themename' ),
		'add_new'               => __( 'Add New', '_themename' ),
		'new_item'              => __( 'New Product', '_themename' ),
		'edit_item'             => __( 'Edit Product', '_themename' ),
		'update_item'           => __( 'Update Product', '_themename' ),
		'view_item'             => __( 'View Product', '_themename' ),
		'view_items'            => __( 'View Products', '_themename' ),
		'search_items'          => __( 'Search Product', '_themename' ),
		'not_found'             => __( 'Not found', '_themename' ),
		'not_found_in_trash'    => __( 'Not found in Trash', '_themename' ),
		'featured_image'        => __( 'Featured Image', '_themename' ),
		'set_featured_image'    => __( 'Set featured image', '_themename' ),
		'remove_featured_image' => __( 'Remove featured image', '_themename' ),
		'use_featured_image'    => __( 'Use as featured image', '_themename' ),
		'insert_into_item'      => __( 'Insert into Product', '_themename' ),
		'uploaded_to_this_item' => __( 'Uploaded to this Product', '_themename' ),
		'items_list'            => __( 'Products list', '_themename' ),
		'items_list_navigation' => __( 'Products list navigation', '_themename' ),
		'filter_items_list'     => __( 'Filter Products list', '_themename' ),
	);
	$args = array(
		'label'                 => __( 'Product', '_themename' ),
		'description'           => __( 'Product post type', '_themename' ),
		'labels'                => $labels,
		'supports'              => array( 'title' ),
		'taxonomies'            => array( 'ae_product_cat' ),
		'hierarchical'          => false,
		'public'                => true,
		'show_ui'               => true,
		'show_in_menu'          => true,
		'menu_position'         => 5,
		'menu_icon'             => 'dashicons-cart',
		'show_in_admin_bar'     => true,
		'show_in_nav_menus'     => true,
		'can_export'            => true,
		'has_archive'           => 'products',
		'exclude_from_search'   => false,
		'publicly_queryable'    => true,
		'capability_type'       => 'page',
		'show_in_rest'          => true,
	);
	register_post_type( 'ae_product', $args );

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