Exclude Specific Product Category for showing up in its parent category page
-
I am displaying a list of product sub-categories in a grid format in the parent Categories. There is a specific category with id 7000 which I want to exclude from the grid.
How do I accomplish this? I have tried the methods mentioned at https://stackoverflow.com/questions/13366764/hide-category-in-the-woocommerce-shop-page but they did not work for me so what is the best way to accomplish this?
Here is how my code for
archive-product.php
looks like<ul class="products columns-4"> <?php $p_childrens = get_term_children($queried_object->term_id, $queried_object->taxonomy); if (!empty($p_childrens)) { foreach ($p_childrens as $p_children) { $c_term = get_term($p_children, $queried_object->taxonomy); if (!empty($c_term)) { $term_link = get_term_link($c_term); $thumbnail_id = get_woocommerce_term_meta($c_term->term_id, 'thumbnail_id', true); $image = wp_get_attachment_url($thumbnail_id); if (empty($image)) { $image = wc_placeholder_img_src(); } ?> <li class="product-category product"> <h3><?php echo $c_term->name; ?></h3> <a href="<?php echo $term_link; ?>"> <img src="<?php echo $image; ?>" alt="<?php echo $c_term->name; ?>"/> </a> <a class="btn btn-primary" href="<?php echo $term_link; ?>">View All Products</a> </li> <?php } } } ?> </ul>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Exclude Specific Product Category for showing up in its parent category page’ is closed to new replies.