Products category search not working
Products category search not working
Products category search not working
I found a solution. <?php $term = get_queried_object(); $children = get_terms( $term->taxonomy, array( ‘parent’ => $term->term_id, ‘hide_empty’ => false ) ); if ( $children ) { foreach( $children as $subcat ) { $size = “thumbnail”; echo ‘ <div class=” cat-box “>’; $image = get_field(‘image’, ‘category_’ . $subcat->term_id); echo ‘<img src=”‘ . $image . ‘” />’; … Read more
For some reason the add_action( ‘pre_get_posts’, ‘category_custom_orderby’ ); hook isn’t working. Yes, and it’s because on the Categories admin page (where you can see the Categories list table), the list table uses WP_Term_Query and not WP_Query, hence the above hook (pre_get_posts) is not fired. So instead of the above add_action(), try using the parse_term_query hook … Read more
How to show the clicked category related posts on category detail page?
What you show on the image is the post status, not a taxonomy. But a filter already exists to do what you want. Go where you wrote your categories and on the right must be numbers. It’s the number of post_type in each category. Click that number and you’ll see the pages for the clicked … Read more
To sort hierarchically, try adding a sorting function to your functions.php (or plugin). // This will sort and place everything in the $into array function sort_terms_hierarchically(Array &$cats, Array &$into, $parentId = 0) { foreach ($cats as $i => $cat) { if ($cat->parent == $parentId) { $cat->posts = array(); $into[$cat->term_id] = $cat; unset($cats[$i]); } } foreach … Read more
You would need to either get the color of the direct parent or loop thorugh all ansestors until you find the color. If no color found get the default and output. I made a few changes to the structure and added all comments for each step. Notice that I included two options to achive the … Read more
you can do this in the file 404.php, start the file with some kind of check if is page, if so redirect to that link, if is not page redirect to category page with that slug else just let the 404.php page this is in the file 404.php
You need to access the Woo product loop, to output extra content on shop/archive pages (unless you use a custom template) Try something like this: add_action( ‘woocommerce_after_shop_loop_item’, ‘conditional_label’, 5 ); function conditional_label() { global $product; if (has_term( ‘new’, ‘product_cat’, $product->get_id())) { echo ‘<p class=”new-lable”>New</p>’; } } Not tested, but should get you in the right … Read more
How to remove category name for only one category?