Taxonomy Category And Subcategory
-
Hello guys, I’m not very good at English, but I’m gonna try.
I’m in the following case:
– I need to create a panel session to register products with their respective categories and subcategories.
EX:
Category:
– Vase / Chair / T-shirtSubCategory:
– Vase
— Clay Pots (Pot belongs to category Vase)
— Vessels Cement (belongs to category Vase)– Chair
– Reclining Chairs (Chair belongs to category Chair)
– Padded Chairs (Chair belongs to category Chair)– T-shirt
– Regatta (belongs to category T-shirt)
– Polo (belongs to category T-shirt)I need to create this structure to register a product.
EX:
Product: ProdX
– Category: T-shirt
– Subcategory: PoloWell, I do not know how I do the record straight, I only have part of the product / category ready.
add_action('init', 'product_register'); if (!function_exists('product_register')) { function product_register() { $labels = array( 'name' => __('Product', 'tkwave'), 'singular_name' => __('Product', 'tkwave'), 'add_new' => __('Add New', 'tkwave'), 'add_new_item' => __('Add New Product', 'tkwave'), 'edit_item' => __('Edit Product', 'tkwave'), 'new_item' => __('New Product', 'tkwave'), 'all_items' => __('All Products', 'tkwave'), 'view_item' => __('View Product', 'tkwave'), 'search_items' => __('Search Products', 'tkwave'), 'not_found' => __('No Producct found', 'tkwave'), 'not_found_in_trash' => __('No Product found in Trash', 'tkwave'), 'menu_name' => __('Products', 'tkwave') ); $args = array( 'labels' => $labels, 'public' => true, '_builtin' => false, 'capability_type' => 'post', 'menu_icon' => THEME_DIR . '/framework/assets/images/product.png', 'hierarchical' => false, 'rewrite' => array( 'slug' => 'product'), 'supports' => array('title', 'editor', 'thumbnail') ); register_post_type('product', $args); flush_rewrite_rules(); } } register_taxonomy("products", array("product"), array("hierarchical" => true, "label" => __("Categories", "tkwave"), "singular_label" => __("Product Categorie", "tkwave"), "rewrite" => true));
- The topic ‘Taxonomy Category And Subcategory’ is closed to new replies.