Forums › Forums › Search & Filter Pro › Results showing without any search
- This topic has 6 replies, 3 voices, and was last updated 7 years, 7 months ago by Ross.
-
Anonymous(Private) July 18, 2015 at 11:14 am #21638
Hi
I’ve installed the pro version on my dev site. Just have one odd issue. I’m using the shortcode method to display the search form and results on the same page (as recommended). When I visit the page it’s displaying all results without any search being performed.
I have auto submit turned on, but results are showing on the initial page load, so before the user has searched for anything.
I’m using it on a custom post and taxonomy.
Any thoughts why this is happening? WP_Query contains search results so it seems to be triggering for some reason.
WP 4.2.2 running on AWS EC2 instance with LAMP stack. Latest version of the plugin is installed.
Ross Moderator(Private) July 21, 2015 at 1:37 pm #21795Hi Chris
This is actually the way it is intended.
Your search results page is an “unfiltered” list of items that match your settings, you narrow them down by searching & filtering.
I understand that there is another use case here so am adding in an option for this in the next version.
Otherwise you could hide the results with CSS for now, and show them when an an ajax request has completed – see link for ajax events – http://www.designsandcode.com/wordpress-plugins/search-filter-pro/faqs/
Thanks
Ross Moderator(Private) July 21, 2015 at 4:47 pm #21817Ah cool, just so you know, next version of S&F has a caching system built in which makes searching/browsing large DBs a lot faster 🙂
Anonymous(Private) July 21, 2015 at 5:35 pm #21824Sounds great!
May be something you want to add in to your next release as well… I needed to be able to filter the taxonomy list so that certain parent/sub categories were not displayed. There didn’t seem to be an easy way to do this, so I added a filter to your code (public/includes/class-search-filter-taxonomy-walker.php) to the display_element.
if (apply_filters(‘check_taxonomy’, $element, $children_elements, $depth))
parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output );Worked a treat.
Really great plugin, btw!
Anonymous(Private) April 6, 2017 at 7:07 pm #101840Hi,
Was wondering if this option to hide results by default has been enabled in the latest version. I require this functionality too.
I tried by setting the style for the results div with id “sfresults” to “display:none” in the css file and then added the below code in footer.php but it does not work. The hidden div on page load does not change its style on completion of ajax request.
*****************************
*****************************Please help.
Ross Moderator(Private) April 6, 2017 at 9:07 pm #101872Wrap it in a function should work as loading the script in the footer directly has no dependency, so jquery or S&F might not even be loaded properly –
<script> (function ( $ ) { $(document).on("sf:ajaxfinish", ".searchandfilter", function(){ console.log("ajax complete"); //so load your lightbox or JS scripts here again document.getElementById("sfresults").style.display = "inline"; }); }(jQuery)); </script>
You can actually check in your results template (no need for JS) if something has been filtered, to display alternate content, check out this reply –
https://support.searchandfilter.com/forums/topic/search-and-filter-issues/#post-97498
And docs:
Best
-
AuthorPosts