I have 2 loops, one for the sticky blog posts (they are limited to 3 per page) and one for the rest of the posts. I want to show the 3 sticky posts + 5 of the other posts per page. Displaying only 5 of the other posts per page doesn’t work. This is the loop for them:
$loop2query = new WP_Query('ignore_sticky_posts=1'.'showposts=5'.'&paged='.$paged);
// START 2ND LOOP.
if ($loop2query->have_posts()) : while ($loop2query->have_posts()) : $loop2query->the_post();
// Show all posts except the 3 posts in the 1st loop.
if(in_array($post->ID, $do_not_duplicate)) continue; ?>
<div class="blogpost">
<h2><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<p>Written on <?php the_time('m/d/Y') ?>. Filed under <?php the_category(', '); ?>.</p>
</div>
<?php the_excerpt();
endwhile; endif; // END 2ND LOOP. ?>
I think 'showposts=5'.'&paged='.$paged
must be the correct way to limit the posts per page, but I am note sure if I have used in my query correctly.
I use this code to limit my category and post numbers per page, try it: