This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Filter collapse option?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #41450
    RankerRanker
    Participant

    Hi, I would like to know if there is any way to collapse the filter settings. See image attached or link: https://werkenbij.mybrand.nl/vacatures-testpagina/

    #41465
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi!

    By default there is no option to enable that, however it should be possible via a bit of custom code and some custom CSS.

    Try adding this code to the functions.php file in your theme/child theme directory – make sure to have a full server back-up first for safety. For more details you can check the safe coding guidelines.

    add_filter('wp_footer', 'asp_my_custom_script', 10);
    function asp_my_custom_script() {
      ?>
      <script>
      jQuery(function($) {
        $('.asp_ss fieldset>legend').on('click', function(){
    		$(this).closest('fieldset').toggleClass('asp_filter_opened');
    	});
      });
      </script>
      <?php
    }

    Apply this code to your theme custom CSS field (if it supports it) or use the custom CSS field on the search plugin back-end.

    .asp_ss fieldset legend {
        cursor: pointer;
    }
    
    .asp_ss fieldset div.asp_option {
        display: none !important;
    }
    
    .asp_ss fieldset.asp_filter_opened div.asp_option {
        display: flex !important;
    }

    This will hide the settings by default, and open them once the user clicks on the header of the filter.

    #41476
    RankerRanker
    Participant

    Wow! That does the trick Ernest. Is there a way to online open the first layer option “locatie” and close the others?

    Thanks again mate!

    PS: Would be a great feature to add in the plugin.

    • This reply was modified 3 years, 3 months ago by Ranker.
    • This reply was modified 3 years, 3 months ago by Ranker.
    • This reply was modified 3 years, 3 months ago by Ranker.
    #41489
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Thank you, it will be definitely added in a later release 🙂

    I think that is also possible, try chaning the first recommended code to:

    add_filter('wp_footer', 'asp_my_custom_script', 10);
    function asp_my_custom_script() {
      ?>
      <script>
      jQuery(function($) {
        $('.asp_ss fieldset>legend').on('click', function(){
    		$(this).closest('fieldset').toggleClass('asp_filter_opened');
    	});
        $('.asp_filter_cf_locatie legend').trigger('click');
      });
      </script>
      <?php
    }
    #41501
    RankerRanker
    Participant

    Works! Thank you for the great support.

    #41506
    Ernest MarcinkoErnest Marcinko
    Keymaster

    You cannot access this content.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.