How do I close the result panel when I haven't selected anything?

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 Ernest Marcinko 2 years ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #37224
    Yasutake Yohei
    Yasutake Yohei
    Participant

    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?

    • This topic was modified 2 years, 1 month ago by Yasutake Yohei .
    #37234
    Ernest Marcinko
    Ernest Marcinko
    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
    }
    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #37240
    Yasutake Yohei
    Yasutake Yohei
    Participant

    Thank you for your prompt attention. It worked!

    #37250
    Ernest Marcinko
    Ernest Marcinko
    Keymaster
    You cannot access this content. Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.