Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Loại Sản Phẩm

Thêm Taxonomy loại sản phẩm

if ( ! function_exists( 'loai_san_pham' ) ) {

// Register Custom Taxonomy
function loai_san_pham() {

	$labels = array(
		'name'                       => _x( 'Loại sản phẩm', 'Taxonomy General Name', 'kingscript' ),
		'singular_name'              => _x( 'Loại sản phẩm', 'Taxonomy Singular Name', 'kingscript' ),
		'menu_name'                  => __( 'Loại Sản Phẩm', 'kingscript' ),
		'all_items'                  => __( 'Tất cả', 'kingscript' ),
		'parent_item'                => __( 'Parent Item', 'kingscript' ),
		'parent_item_colon'          => __( 'Parent Item:', 'kingscript' ),
		'new_item_name'              => __( 'Tên loại', 'kingscript' ),
		'add_new_item'               => __( 'Thêm mới', 'kingscript' ),
		'edit_item'                  => __( 'Sửa', 'kingscript' ),
		'update_item'                => __( 'Cập nhập', 'kingscript' ),
		'view_item'                  => __( 'Xem', 'kingscript' ),
		'separate_items_with_commas' => __( 'Phân tách các mục bằng dấu phẩy', 'kingscript' ),
		'add_or_remove_items'        => __( 'Thêm hoặc xoá mục', 'kingscript' ),
		'choose_from_most_used'      => __( 'Chọn từ sử dụng nhiều', 'kingscript' ),
		'popular_items'              => __( 'Mục phổ biến', 'kingscript' ),
		'search_items'               => __( 'Tìm mục', 'kingscript' ),
		'not_found'                  => __( 'Không tìm thấy', 'kingscript' ),
		'no_terms'                   => __( 'Không có mục nào', 'kingscript' ),
		'items_list'                 => __( 'Danh sách', 'kingscript' ),
		'items_list_navigation'      => __( 'Điều hướng danh sách mục', 'kingscript' ),
	);
	$rewrite = array(
		'slug'                       => 'loai-san-pham',
		'with_front'                 => true,
		'hierarchical'               => true,
	);
	$args = array(
		'labels'                     => $labels,
		'hierarchical'               => false,
		'public'                     => true,
		'show_ui'                    => true,
		'show_admin_column'          => true,
		'show_in_nav_menus'          => true,
		'show_tagcloud'              => true,
		'rewrite'                    => $rewrite,
	);
	register_taxonomy( 'loai-san-pham', array( 'product' ), $args );

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

}