This topic has 9 replies, 3 voices, and was last updated 7 years, 12 months ago ago by Jack Richardson
Hi – I am building a site for a client that has seasonal categories such as Christmas. I would like to have this category now display at certain times of the year. I removed it from my menus but it shows under Product Categories on my homepage and under categories on my product pages.
Any way to hide a category, or turn off and back on that work with this theme?
Thanks!
Hello,
Try to add this code in functions.php file:
add_action( 'pre_get_posts', 'custom_pre_get_posts_query' );
function custom_pre_get_posts_query( $q )
{
if (!$q->is_main_query() || !is_shop()) return;
if ( ! is_admin() )
{
$q->set( 'tax_query', array(array(
'taxonomy' => 'product_cat',
'field' => 'id',
'terms' => array( 57 ),
'operator' => 'NOT IN'
)));
}
}
where 57 is a category id, replace it with your id.
Regards,
Eva Kemp.
Thanks Eva but it is still appearing everywhere. You can see, thanksgiving category.
Hello,
Please provide FTP and WP Dashboard credentials in private content.
Regards,
Eva Kemp.
See in private
Hello,
I’ve added this code in child style.css:
.cat-item.cat-item-110 {
display: none;
}
and “Thanksgiving” category is hidden in sidebar in Shop page.
As for home page, I recommend you to use Woo Product Categories element in Visual Composer editor and select what categories to display.
Please try it.
Regards,
Eva Kemp.
Thanks, I will try that. I just noticed something else broken, not sure if it is related to any of the fixes. For some reason now the dropdown menu doesn’t work. When I hover over Occasions or any of the others on the main menu nothing happens. Can you check this out as soon as possible please as I would like to launch tomorrow?
Thanks
See below
Hello,
Ok, let us know if further assistance is needed.
Best regards,
Jack Richardson.
You must be logged in to reply to this topic.Log in/Sign up