Forums › Forums › Search & Filter Pro › Only Show Results Once Submitted
- This topic has 3 replies, 2 voices, and was last updated 6 years, 7 months ago by
Trevor.
-
Anonymous(Private) February 15, 2020 at 2:20 pm #234004
I am using the shortcode for search and results on the same page.
This all works fine. However as default the results shortcode shows all results possible before a search is made.
Is there a way to set it, that when you go to this page, it only shows the search bar, and then when a search is made, it shows the results, instead of showing all results as default?
Thanks Mike
Trevor(Private) February 17, 2020 at 10:51 am #234043You would need to be using our Shortcode Display results method (as you are), and have followed the ‘guide to customising’:
Once you have a copy of the results.php file in a
search-filtersub-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(1605)->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 } -
AuthorPosts