Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Filter collapse option?
This topic contains 5 replies, has 2 voices, and was last updated by Ernest Marcinko 1 month, 1 week ago.
- AuthorPosts
- February 19, 2023 at 2:07 am #41450
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/
February 20, 2023 at 1:25 pm #41465Hi!
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.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
February 20, 2023 at 4:33 pm #41476Wow! 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.
February 21, 2023 at 11:27 am #41489Thank you, it will be definitely added in a later release 🙂
I think that is also possible, try chaning the first recommended code to:
Best,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 }
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
February 21, 2023 at 6:16 pm #41501Works! Thank you for the great support.
February 22, 2023 at 1:51 pm #41506You cannot access this content. Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
- AuthorPosts
You must be logged in to reply to this topic.