Views 1.6 now has a fantastic Ajax Filter, how can we have a Load More button? for instance we set Limit of 9 results when filtering, but a Load More button to Load further results?
Dear Muhammad,
We dont have that feature included in Views yet, but I came across this post recently. I haven't has the chance to test it yet but it may help you:
hidden link
Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.
Regards,
Caridad
I know about this snippet too but how can i integrate that with Views? I would appreciate it if you can point me to the right direction.
Oh sorry that was a different snippet, this one is for Views, i will test it and get back to you, Thanks.
Where do i include that JS Snippet and how do i call that function in 1.6? As there is an option for Calling JS.
If somehow you can make this work with ver 1.6 that willbe great, please let me know asap.
Dear Muhammad,
You need to set your view to have "No Pagination".
Copy and paste the javascript in the "JS editor" section of the View.
1) make sure that the main container hass a class="main_table"
2) add a link with the "load_more" class
For example:
[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<table width="100%" class="main_table">
<tbody>
<wpv-loop>
<tr>
<td>[wpv-post-link]</td>
</tr>
</wpv-loop>
</tbody>
</table>
<a href="#load_more" class="load_more">Load more</a>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"]<strong>No items found</strong>[/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]
Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.
Regards,
Caridad
I have tried exactly like this but somehow it doesn't load more posts, i am using version 1.6
Have you tested it on your end?
Dear Muhammad,
Yes, I did. Can you provide a URL to the page?
Thanks
Caridad
Its the same old URL with Ajax Search page, oldurl.com/ajax-search
sorry on a mobile
Okay using your layout, i finally made the Load More option work, Thanks alot!
But date takes a long time to be selected and also the Ajax is loading late too.
Also, once you do the search, the load more button doesn't work, doesn't load more, it works only on all the posts loaded at first.
Dear Muhammad,
What I see is that the "load more" button is showing even if its not needed. For example, if we have less than 6 results, it should be hidden.
You can try showing the button like this:
[wpv-if evaluate="[wpv-found-posts]>6"]
<a href="#load_more" class="load_more">Load more</a>
[/wpv-if]
Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.
Regards,
Caridad
Hi,
But for instance when we use the filter and we have over 30 results, the button will show but the button will not work or it will show the results just like without using a filter?
Regards,
Shahzad