This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

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?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #37224
    Yasutake YoheiYasutake 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 4 years, 2 months ago by Yasutake Yohei.
    #37234
    Ernest MarcinkoErnest 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
    }
    #37240
    Yasutake YoheiYasutake Yohei
    Participant

    Thank you for your prompt attention. It worked!

    #37250
    Ernest MarcinkoErnest Marcinko
    Keymaster

    You cannot access this content.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.