I have a very annoying issue with 2 wp_query.
Showing 1 post - feature post
<?php $do_not_duplicate = array(); $args = array ( 'post_type' => 'post', 'posts_per_page' => '1', ); $my_query = new WP_Query( $args ); if ($my_query->have_posts()) : while($my_query->have_posts()) : $my_query->the_post(); $do_not_duplicate[] = $post->ID; get_template_part( 'content-feat',get_post_format() ); endwhile; endif; wp_reset_postdata(); ?>
The rest of the posts
<?php // the query to set the posts per page to 6 query_posts($args); $args = array( 'posts_per_page' => 6, 'paged' => $paged, ); $my_query = new WP_Query( $args ); if ($my_query->have_posts()) : while($my_query->have_posts()) : $my_query->the_post(); if ( !in_array( $post->ID, $do_not_duplicate ) ) { // check IDs get_template_part( 'content', get_post_format() ); } endwhile; endif; ?>
The problem:
Second loop is removing the post from first query (like its suppose to do) and should show 6 posts.
The problem is that is showing on first page 5 posts and on second 6 posts. I don't know where is the problem, can u guys help me? I'm kinda stuck with this issue. Thx