Opened widget category closed default not opened

This topic has 5 replies, 2 voices, and was last updated 2 years, 3 months ago ago by Rose Tyler

  • Avatar: Eduard
    Eduard
    Participant
    September 4, 2022 at 14:33

    How can I make them closed as default, not open as they are now

    https://gyazo.com/49b36384edd95c0070e93b6e3bd55a24

    Thank you

    4 Answers
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    September 4, 2022 at 14:52

    Hello,

    Go to Theme Options > WooCommerce > Shop elements > Categories > disable option “Open Product Categories Widget By Default”.

    Regards

    Avatar: Eduard
    Eduard
    Participant
    September 4, 2022 at 14:57

    Done but not work…help please

    Avatar: Eduard
    Eduard
    Participant
    September 4, 2022 at 16:44

    it works on the shop page but not on other pages, see video bellow
    https://gyazo.com/6904ec4721dcfe30f85ab7b9983b76e8

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    September 5, 2022 at 13:51

    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

  • Viewing 5 results - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.Log in/Sign up

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.