Perhaps add a “posts_per_page” argument in the second WP_Query() loop?
I did it but still happening.
jumping over the duplicate posts might be causing the problem;
as in this line:
if ( in_array( $post->ID, $do_not_duplicate ) ) continue;
try excluding them with 'post__not_in'
parameter for the second query.
https://codex.wordpress.org/Class_Reference/WP_Query#Post_.26_Page_Parameters
and you might need to set the 'posts_per_page'
for the second query to 6
also, add wp_reset_postdata()
after each loop; https://codex.wordpress.org/Function_Reference/wp_reset_postdata
and review https://codex.wordpress.org/Function_Reference/next_posts_link#Usage_when_querying_the_loop_with_WP_Query
Thanks for your answer.
First the ‘<?php wp_reset_postdata(); ?>
‘ should go before the first endwhile; (first loop) and the second one before of the endif; (second loop). Right?
When i put the ‘post_per_page
‘ in the second loop i get six post in the first page in total but 9 in the previous page. I think this is related with the ‘post__not_in
‘ that i don’t understand how to implement this parameter.
Thanks
<?php wp_reset_postdata(); ?>
goes after the endwhile of both loops.
review https://codex.wordpress.org/The_Loop#Multiple_Loops_in_Action
Thank you, still having this issue with the pagination
what are the specific problems now?
do the posts show as you’ve intended?
what exact code are you using right now?
I have two loops, one featuring the 3 latest post and then the second one to show the others post. I have 9 post per page, 3 for the featured and 6 for not featured.
do you want to keep the same three featured posts on the second page and any further pages?
this is how I would implement the suggestions into your initially posted code:
http://pastebin.com/CffQksuN
(the same three featured posts every page, then six other posts, and working pagination)
Thank you so much! That’s what i needed. You made my day <3