WP_Query - Adding “offset” posts to the end of the loop
Question
I'm trying to create two queries.
In the first query, I will, for example, display 6 posts, in a given order.
In the second query, I want to display the same 6 posts, but "offset" the first 3 and then have those same 3 appear at the end.
For example, Query #1 would return:
1 2 3 4 5 6
Then, Query #2 would return:
4 5 6 1 2 3
Any ideas on how I might pull this off??
Solution
No need to have two queries, you can just reuse the same post data by resetting the current post position and running the loop again: $wp_query->current_post = 2;
you'd have to do this twice to achieve what you're asking, and stop it the second time at the third post.
Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange