Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › How do I close the result panel when I haven't selected anything?
This topic contains 3 replies, has 2 voices, and was last updated by Ernest Marcinko 1 year ago.
- AuthorPosts
- March 21, 2022 at 9:42 am #37224
Hi, thank you for making a great plugin.
(Admin Username and Password are for BASIC authentication.)
According to the following content, I made the settings so that the results would be displayed even if you did not enter any characters in the search box. However, once you select some checkbox and then unselect it again, live search will show all the results.
https://wp-dreams.com/knowledge-base/allowing-empty-search-phrase/
What if you don’t want to display the results when none of the checkboxes are selected and there are no characters in the search box at the same time?
March 21, 2022 at 4:21 pm #37234Hi,
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.
Best,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 }
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
March 21, 2022 at 6:10 pm #37240Thank you for your prompt attention. It worked!
March 22, 2022 at 10:59 am #37250You 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.