Forums › Forums › Search & Filter Pro › double load effect when there is only one page of results
Tagged: infinite scroll
- This topic has 9 replies, 4 voices, and was last updated 3 years, 7 months ago by
Trevor.
Viewing 9 posts - 1 through 9 (of 9 total)
-
Ross Moderator(Private) February 27, 2020 at 7:25 pm #235131This reply has been marked as private.Ross Moderator(Private) February 28, 2020 at 7:00 pm #235238
Hi Jonathan
So I found a solution to this.
S&F was ignoring
data-search-filter-action='infinite-scroll-end'
on page load, and only looking for it AFTER fetching more results via Ajax.I have updated our plugin to fix this.
All you need to do is add the attribute to your results somewhere, when you know the current set of results are in fact the total set of results, for my testing, I modified our infinite scroll template by doing this:
Found <?php echo $query->found_posts; ?> Results<br /> <?php //prevent double load effect if the first set of results are the total results $page = intval($query->query_vars['paged']); $infinite_scroll_end_markup = ''; if($page==1){ if(intval($query->found_posts) <= intval($query->query_vars['posts_per_page'])){ //then all the results loaded in the first page $infinite_scroll_end_markup = " data-search-filter-action='infinite-scroll-end'"; } } ?> <div class='search-filter-results-list' <?php echo $infinite_scroll_end_markup; ?>>
…
I hope that helps 🙂
Ross Moderator(Private) March 3, 2020 at 12:24 pm #235408Hi Jonathan
Just to confirm that all worked ok and I can close this thread?
Thanks
-
AuthorPosts
Viewing 9 posts - 1 through 9 (of 9 total)