[Resolved] using post__not_in and pagination issue
I am using a page template for the front page, and have 2 queries. First one retrieves the latest post from a category called ‘todays post’ using WP Query as the featured top post on the front page, and the second one is the main loop showing all posts. Both queries are pulling from 3 custom post types, I’m using the wp_pagenavi plugin. I have the main loop set to 6 posts per page.
Everything works splendidly, I used the $do_not_duplicate trick I read from here, and set one of the arguments in the main loop to
'post__not_in' => array($todays_post)
I also us
if(! is_paged())to run and show the todays post latest post only on the first page.
This works as well. All except for one nagging thing. When you go to page 2, the 6th (last post on page one) repeats as the first post on page 2. If I change the post__not_in to exclude the whole todays post category, the problem disappears. Everything is great.
Also, if I remove the conditional on the top featured loop and allow it to appear on all pages, the problem disappears.
Hopefully this is enough info, and any help is greatly appreciated.
edit: here’s the template in pastebin http://pastebin.com/kiT63zDA
Also should add, I did use WP Query for the second loop originally, but tried query_posts to see if it made a difference, the results are exactly the same.
- The topic ‘[Resolved] using post__not_in and pagination issue’ is closed to new replies.