Forums Forums Search & Filter Pro Hide Results until Search is Submitted

Viewing 3 posts - 1 through 3 (of 3 total)
  • Anonymous
    #190148

    I’m using the shortcode method with Ajax and a submit button and tried following this method to hide results until a search is submitted. The search results are hidden but then nothing shows when I submit the search. Do you know what could be wrong? I added the code to my custom results template.

    https://support.searchandfilter.com/forums/topic/force-selection/#post-87657

    Anonymous
    #190149

    I tried setting the opacity of .search-filter-results to 0 and that seems to do the trick since an opacity of 1 is added inline once a search is completed. I would have liked to get the template code working but this solution will do.

    Trevor
    #190171

    If you are using the Shortcode results method, and our results.php template file, it would look like this:

    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(1024)->current_query();
    if ((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()=="")) {
      echo '<div>Nothing to see here folks!</div>'; 
    } else {
      // your template archive code/loop OR results.php code here
    }

    Change 1024 to the ID number of your form (from the form shortcode).

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