Support Forums

The forums are closed and will be removed when we launch our new site.

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro Don’t Show Results Until User Clicks Submit/Search

Tagged: , ,

Viewing 2 posts - 1 through 2 (of 2 total)
  • thomas merriott
    #262116

    Is there a way to make the plugin not show results at all (on page load) until the user clicks submit? Trying to reduce initial page load speed and considering all options.

    Trevor Moderator
    #262240

    Are you able to send me a live link/URL to your search page so I can take a look?

    Which Display Results Method are you using? With some, it cannot be done, with those using a PHP template, it can, with some coding. For example, using our Shortcode method …

    … in which case you should follow the ‘guide to customising’:

    https://support.searchandfilter.com/documentation/search-filter-pro/search-results/using-a-shortcode/

    Once you have a copy of the results.php file in a search-filter sub-folder of your theme, you can edit that file, like this (leave the PHP comments at the top outside and before this code):

    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(1234)->current_query();
    if ((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()=="")) {
      echo '<div>Nothing to see here folks!</div>'; 
    } else {
      // the current resuts.php code here
    }

    Where the ID number in this needs to match your form ID (replace 1234). Similar code can be used in your own PHP template file.

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

The forum ‘Search & Filter Pro’ is closed to new topics and replies.