dokan category drop_down
-
Hi,
i;ve made this menu to make some changes i want
but it’s not working can you tell me what i’ve missed??
i want to make the parent category disabled and not available to choose$taxonomy = 'product_cat'; $orderby = 'id'; $show_count = 0; // 1 for yes, 0 for no $pad_counts = 0; // 1 for yes, 0 for no $hierarchical = 1; // 1 for yes, 0 for no $title = ''; $empty = 0; $args = array( 'id' => 'product_cat', 'taxonomy' => $taxonomy, 'orderby' => $orderby, 'show_count' => $show_count, 'pad_counts' => $pad_counts, 'hierarchical' => $hierarchical, 'title_li' => $title, 'hide_empty' => $empty, 'exclude' => '', 'hide_empty' => 0, ); $all_categories = get_categories($args); echo '<select name="cat" method="post">'; foreach ($all_categories as $cat) { if ($cat->category_parent == 0) { $category_id = $cat->term_id; echo '<option disabled>' . $cat->name . '</option>'; $args2 = array( 'id' => 'product_cat', 'taxonomy' => $taxonomy, 'child_of' => 0, 'hide_empty' => 0, 'parent' => $category_id, 'orderby' => $orderby, 'show_count' => $show_count, 'pad_counts' => $pad_counts, 'hierarchical' => $hierarchical, 'title_li' => $title, 'hide_empty' => $empty, 'exclude' => '', ); $sub_cats = get_categories($args2); if ($sub_cats) { foreach ($sub_cats as $sub_category) { echo '<option value="'. $sub_category->term_id.'">' . $sub_category->name .'</option>'; } } } } echo '</select>'; update_post_meta($product_id, 'category', $get_data['cat']);
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘dokan category drop_down’ is closed to new replies.