WebNov 21, 2012 · First, you have to get current category's id: $category_id = get_query_var ('cat'); Then you can make a database query to see it has a parent or not: $parent = $wpdb->get_var ("SELECT parent FROM ".$wpdb->prefix."term_taxonomy WHERE term_id = … WebMar 10, 2016 · Get parent category name from subcategory - WooCommerce Ask Question Asked 7 years ago Modified 4 years, 3 months ago Viewed 6k times 0 I am trying to find the parent category name when within a subcategory page on WooCommerce, i.e. I have 4 main categories. Parent1 Sub 1 Sub 2 Sub 3 etc Parent2 Sub 1 Sub 2 Sub 3 etc …
Get all product categories in WooCommerce - Stack Overflow
WebAug 17, 2024 · I want to get all parent subcategories including it self 4. I dont have parent ID, i have only category_id that have parent_category that i need. What i did so far. SELECT child.* FROM `ec_categories` AS `child` LEFT JOIN `ec_categories` AS `parent` ON `child`.`parent_id`=`parent`.`id` WHERE `child`.`id` = '4' Is there a way to get them … WebAnd I can't seem to get the parent category's slug. I know i'm probably missing a simple step somewhere, but any insight would be greatly appreciated. categories; Share. Improve this question. Follow asked Jan 25, 2014 at 21:40. DLR DLR. 165 1 1 gold badge 2 2 silver badges 5 5 bronze badges. st. john baptist church in gary indiana
How do I get the parent category name in WordPress template?
WebOct 6, 2024 · What I'm trying to do is display a menu in my Woocommerce shop's sidebar with the current product category name and current categories children. If the product category has no children, then it should display the parent category and parent category children. This is how the hierarchy looks: SHOP > PREPARED FOODS > FOODSTUFF WebNov 19, 2024 · So for “Ipa” category “single-product-default” template is loading but I want “single-product-browar” and for each child category of “beer” parent category. Now makes sense what’s the issue, so by default has_term() will only look for categories linked into your product, so if you only select Ipa and not Beer , has_term() will ... WebMar 19, 2024 · In WooCommerce, I am trying to get all child product category terms from the parent term id of the current product category with the code below: st. john beach bar webcam