I can’t work out how to change the number of posts listing on the first blog page only. I will need to list 4 normal posts on the first page and 6 normal posts on any other page. I found a few examples on StackExchange but my case is slightly different because I also have Featured post on the first page, which belongs to the Featured category and 4 other normal posts. From the second page on, there is no Featured post showing, only 6 normal posts.
This code works really well with the Featured posts, but can’t find a way to change the number of normal posts showing. Every time I add
new WP_Query() for the second loop the Featured post stops working.
<ul class="grid grid--blog"> <?php $do_not_duplicate = 0; if(!is_paged()): $featured = new WP_Query('category_name=featured&posts_per_page=1'); while ($featured->have_posts()) : $featured->the_post(); $do_not_duplicate = $post->ID; ?> <li class="grid__item grid__item-featured"><?php get_template_part( 'entry' ); ?></li> <?php endwhile; endif; if (have_posts()) : while (have_posts()) : the_post(); if( $post->ID == $do_not_duplicate ) continue; ?> <li class="grid__item"><?php get_template_part( 'entry' ); ?></li> <?php endwhile; endif; ?> </ul>
and this is the desired layout:
First Blog listing page
All the other Blog listing pages
Any help would be very appreciated!