Forums › Forums › Search & Filter Pro › hide results on initial page load
- This topic has 3 replies, 3 voices, and was last updated 6 years, 7 months ago by Trevor.
-
Anonymous(Private) April 11, 2018 at 9:16 am #171423
When the user first goes to the page I would like to hide the search results.
I only want to show the search results after a user has actually searched.
I tried this code:.cn_main_table{ display: none; /* hide initially */ }
/* show search and filter results after search */ $(".searchandfilter").on("sf:ajaxfinish",function(e, x){ //show my results here $(".cn_main_table").show(); console.log(e); console.log(x); });
the search results table is being hidden initially but not showing after a user searches.
How should I write the jquery to show the results after a user clicks ‘search’
http://lekedoshim.mgtestsite.com/choose-nofel/?nofel_id=28555&learning_item_id=35054Anonymous(Private) April 11, 2018 at 9:43 am #171426I also tried what you wrote here:
https://support.searchandfilter.com/forums/topic/how-do-i-hide-initial-results/page/2/
addingif ( $query->have_posts() ) { global $searchandfilter; $sf_current_query = $searchandfilter->get(40276)->current_query(); if ($sf_current_query->is_filtered()) { ?>
to the results.php file but the results are now completely hidden – on the initial page load and they are not showing after the search.
Anonymous(Private) April 11, 2018 at 4:41 pm #171544Having same issue. Using the code from https://support.searchandfilter.com/forums/topic/how-do-i-hide-initial-results/page/2/ to hide the results on initial page load, also hides it when submitting the search form.
Trevor(Private) April 11, 2018 at 7:48 pm #171615For both of you, this is the post with the working answer:
https://support.searchandfilter.com/forums/topic/hide-posts-if-nothing-found/#post-169025
-
AuthorPosts