As you will all know looking for plug ins is not an exciting journey so I was not thrilled. However I was lucky enough to find this plug in first search and it works EXACTLY as it says it does, which IME is weird for a plug in! So after simply checking a box my problem is solved and all the annoying posts are hidden from search.
There are a tonne of other free options for the plug in but this is all I needed…for now:)
Well done developer, your plug in is making a difference and is very cool!
]]>I found a solution for this for the main store page, however, on the product category and archive counters, this solution completely removes all subcategories.
function hide_empty_categories( $terms, $taxonomies, $args ) {
$new_terms = array();
foreach ( $terms as $key => $term ) {
if ( is_object( $term ) ) {
if ( $term->count > 0 ) {
$new_terms[] = $term;
}
}
}
return $new_terms;
}
add_filter( 'get_terms', 'hide_empty_categories', 10, 3 );
]]>My site, plugins, etc are updated.
I’m still having problems hiding a category (or product) from the Backer’s ELementor Crowdfunding Grid. I thought this issue was solved…
the options are for ‘Product Category > All categories’ or > Category 1 or > Category 2, etc.
This means that it still shows all Categories with all products, even if a Product/Crowdfunding Campaign is ‘Hidden”.
In a previous post here, it was mentioned that this issue was solved.
Can someone tell how to do this as the picture from the solution posted before is no longer there.
Or else, send me a code that i can insert inside the ‘.elementor-widget-backer-product-grid .elementor-widget-container’ to
display:none;
for a specific category
Your help is appreciated.
Many thanks,
Joao
I’ve tried to keep a campaign hidden from public view and have used the visibility function available in the Crowdfunding product/ campaign.
It doesn’t seem to work.
Can you please advise as to how t hide it.
Many thanks,
J
Been trying to hide the Uncategorized category from view.
Tried the following code in Funtion.php but it doesn’t work as i think it addresses woocommerce but not WP Crowdfunding
code used from here
”
add_filter( 'get_terms', 'ts_get_subcategory_terms', 10, 3 );
function ts_get_subcategory_terms( $terms, $taxonomies, $args ) {
$new_terms = array();
// if it is a product category and on the shop page
if ( in_array( 'product_cat', $taxonomies ) && ! is_admin() &&is_shop() ) {
foreach( $terms as $key => $term ) {
if ( !in_array( $term->slug, array( 'uncategorised' ) ) ) { //pass the slug name here
$new_terms[] = $term;
}}
$terms = $new_terms;
}
return $terms;
}
Can you send me the code to do it?
Thanks
]]>https://ibb.co/SKTXmrB
]]>I have coupons as a product category that is automatically imported so I can’t edit them individually as my edits would be overwritten every day when the datafeed is refreshed.
I want to hide coupons from the shop page as really they aren’t products and look silly in the feed. so I used the code provided in WooCommerce docs to do that, which works.
/**
* Exclude products from a particular category on the shop page
*/
function custom_pre_get_posts_query( $q ) {
$tax_query = (array) $q->get( 'tax_query' );
$tax_query[] = array(
'taxonomy' => 'product_cat',
'field' => 'slug',
'terms' => array( 'coupons-deals' ),
'operator' => 'NOT IN'
);
$q->set( 'tax_query', $tax_query );
}
add_action( 'woocommerce_product_query', 'custom_pre_get_posts_query' );
But it also hides them from the coupons category page which is even worse.
How can I hide them from the shop page, but still show them on their category page?
Thanks
Karen
I tried to add to ‘additional CSS’ but the categories are still shown.
]]>