Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › How do I close the result panel when I haven't selected anything? › Reply To: How do I close the result panel when I haven't selected anything?
March 21, 2022 at 4:21 pm
#37234
Keymaster
Hi,
Thank you for your kind words!
I’m afraid that is not possible via settings. You can try however a custom code. 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_action('wp_footer', 'asp_add_footer_script', 9999);
function asp_add_footer_script() {
?>
<script>
(function($){
$(".asp_main_container").on("asp_search_start", function(event, id, instance, phrase) {
let search = ASP.instances.get(id, instance);
setTimeout(function(){
if ( phrase == '' && search.filtersInitial() ) {
search.searchAbort();
search.hideLoader();
search.hideResults();
}
}, 20);
});
}(WPD.dom));
</script>
<?php
}