Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Filter collapse option? › Reply To: Filter collapse option?
February 20, 2023 at 1:25 pm
#41465
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.