This topic has 5 replies, 2 voices, and was last updated 2 years, 3 months ago ago by Rose Tyler
How can I make them closed as default, not open as they are now
https://gyazo.com/49b36384edd95c0070e93b6e3bd55a24
Thank you
Hello,
Go to Theme Options > WooCommerce > Shop elements > Categories > disable option “Open Product Categories Widget By Default”.
Regards
Done but not work…help please
it works on the shop page but not on other pages, see video bellow
https://gyazo.com/6904ec4721dcfe30f85ab7b9983b76e8
Hello,
It is opened by default if you are located on that category of it’s children but if you want to hide it even in such cases please, add one of next snippets to your child-theme/functions.php
1/ // use this snippet if you want to hide if the main/parent category was opened or it’s children (link of main/parent category opened or it’s children)
add_action('wp_footer', function() {?>
<script type="text/javascript">
if ( etTheme !== undefined ) {
if (etTheme.categoriesAccordion !== undefined) {
var closeAllCategories = function() {
let $this = $('.content-page .product-categories');
if ($this.find('.current-cat, .current-cat-parent').length > 0) {
setTimeout(function() {
$this.find('.current-cat, .current-cat-parent').find('> .open-this').addClass('et-down-arrow').removeClass('et-up-arrow').parent().removeClass('opened').find('> ul.children').hide();
}, 500);
}
}
closeAllCategories();
$(document).on('et_ajax_content_loaded', function (){
closeAllCategories();
});
}
}
</script>
<?php }, 9999);
// use this snippet if you want to hide only if main/parent category was opened (link of main/parent category opened)
add_action('wp_footer', function() {?>
<script type="text/javascript">
if ( etTheme !== undefined ) {
if (etTheme.categoriesAccordion !== undefined) {
var closeAllCategories = function() {
let $this = $('.content-page .product-categories');
if ($this.find('.current-cat.cat-parent').length > 0) {
setTimeout(function() {
$this.find('.current-cat.cat-parent').find('> .open-this').addClass('et-down-arrow').removeClass('et-up-arrow').parent().removeClass('opened').find('> ul.children').hide();
}, 500);
}
}
closeAllCategories();
$(document).on('et_ajax_content_loaded', function (){
closeAllCategories();
});
}
}
</script>
<?php }, 9999);
Regards
You must be logged in to reply to this topic.Log in/Sign up