Forums Forums Search & Filter Pro search results appears before chcecking form

Viewing 6 posts - 1 through 6 (of 6 total)
  • Anonymous
    #265527

    i’ve created an archieve and several forms to manage it.
    It works really pretty but at start (when i open search page) all results apperas (over 1000 now).
    I think forms should give results after fill them, but now all forms are basically chcecked by “all” and show huge list of everthing :X so chcecking form rather “exclude” random content.

    How to turn my search form to show “empty” result at the beginning, and start showing posts after choice form options?

    Trevor
    #265618

    The ability to do this depends on the Display Results method you are using in the form. Which method are you using, and are you able to send me a live link/URL to your search page so I can take a look?

    Anonymous
    #265628
    This reply has been marked as private.
    Trevor
    #265638

    So, 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(8702)->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
    }
    Anonymous
    #266865

    well it seems to be correct but i didn’t solve my problem with filtering.

    i think problem is in search value “All”(displayed as “wszystkie”)
    “all” appears automatically as first value and allow to show all posts as result
    i rather need to make empty slot at first line, like that:
    -[empty]
    -all
    -condition1
    -condition2

    https://archiwumcyfrowe.nsz.com.pl/wyszukaj-zasoby/

    is it possible?

    Trevor
    #266961

    It doesn’t matter what order the options are in, by default ALL will always be selected.

    In what way does the code I gave you not work? If no filters are selected, nothing will show. Is that not what you wanted?

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