Jetpack infinite scroll load only last post
-
Hello
im using jetpack infinite scroll and it works great. Im using Twenty Sixteen theme so its very easy to use infinite scroll.However, im using custom query in my category template for sorting post using form and then im using query posts to retrieve posts:
$order = "&order=DESC"; if ($_GET['sort'] == 'newest') { $order = "&orderby=date"; } if ($_GET['sort'] == 'lowest-price') { $order = "&order=ASC&orderby=meta_value_num&meta_key=price"; } if ($_GET['sort'] == 'popular') { $order = "&orderby=meta_value_num&meta_key=views"; } if ($_GET['sort'] == 'highest-price') { $order = "&orderby=meta_value_num&meta_key=price";} query_posts($query_string . $order); if ( have_posts() ) : // Start the Loop. while ( have_posts() ) : the_post();The code works and whenever someone select the dropdown option, my url will change like: http://www.mysite.com/category/men?sort=highest-price if someone select “Highest price” in dropdown form. The posts then will sort by “highest price” from “Men” category.
Problem is if i using jetpack infinite scroll, when the scroll load, it will only retrieve the last post….
so the first loaded posts are sorted and the post loaded by infinite scroll is only 1 post and that is the last post in that category…Is there any solution for this?
Thanks!
The topic ‘Jetpack infinite scroll load only last post’ is closed to new replies.