Forums › Forums › Search & Filter Pro › Displaying results on load
- This topic has 4 replies, 2 voices, and was last updated 6 years, 6 months ago by Anonymous.
-
Anonymous(Private) May 10, 2018 at 1:38 pm #176835
Hi, I use the shortcode to display results on a page. When the page initially loads it displays all results by default without anything being filtered from the sidebar widget form options. Is there a ways to show a blank page until the user selects any filter options?
Thanks,Anonymous(Private) May 10, 2018 at 2:02 pm #176839I think I may have found a work around by setting opacity: 0 on #search-filter-results-1751 ID in css by default for the results page, then when someone clicks on one of the filters the opacity changes and shows the filtered results. If theres another way let me know,
Thanks,
Trevor(Private) May 10, 2018 at 2:11 pm #176841Are you using our shortcode display results method? If so, edit the results.php file to use code 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).
Make sure you are working on a copy of the results.php file in a search-filter sub-folder of your theme/child theme folder, and not the original in our plugin template folder.
Anonymous(Private) May 10, 2018 at 2:23 pm #176848Hi ok i can try that, but the opacity: 0 on the css seems to do the trick, bit of a fudge but seems to be ok. The opacity changes when results change on the page so by setting it to 0 by defaults gives a blank results page until filter options applied, giving opacity 1.
-
AuthorPosts