Forums › Forums › Search & Filter Pro › Hide posts if nothing found
- This topic has 30 replies, 3 voices, and was last updated 6 years, 6 months ago by Ross.
-
Anonymous(Private) March 29, 2018 at 5:23 pm #169015
Hello,
Thank you for great plugin!
Can you help me, please?
I choose custom display method with wp_query and choose the same result page. If I have no results by choosing filters or using search, all posts are visible. How can I hide them?
ThanksTrevor(Private) March 29, 2018 at 6:31 pm #169025Do you mean that if the user does not use the filters or search, then you want no results? You would need to edit your template file to add some logic in. 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 here }
Change 1024 to the ID number of your form (from the form shortcode).
Anonymous(Private) March 30, 2018 at 11:51 am #169158Of course, please
https://www.dropbox.com/s/i50yx05068hg3p4/events.php?dl=0 -
AuthorPosts