0

How do i change this so after the first three posts it stops the loop and returns with the rest of the posts in a separate row

<?php
    $the_query = new WP_Query( 'posts_per_page=3' );
?>
<?php
    while ($the_query -> have_posts()) : $the_query -> the_post();
?>
    <div class="col-md-4">
        <a href="<?php the_permalink() ?>">
            <?php the_title(); ?>
        </a>
        <?php the_excerpt(__('(more…)')); ?>
    </div>
<?php
    endwhile;
    wp_reset_postdata();
?>
BarneyK
  • 389
  • 4
  • 12
crad98
  • 1
  • 5

1 Answers1

0

posts_per_page=3 will only return 3 posts, so you'll have to change that value to the number of posts (in your case excerpts) you want to display on that page.

Johannes
  • 64,305
  • 18
  • 73
  • 130
  • yh i see that but i only want there to be 3 posts per
    so im wondering how do i put another loop below it with another 3 posts
    – crad98 Jun 02 '22 at 12:35
  • change the value to 6. The `col-md-4` class should take care of the formating – Johannes Jun 02 '22 at 12:44
  • yh that worked i was just thinking there would be a better way of doing it thanks for your help mate – crad98 Jun 02 '22 at 13:36