phpwordpressloopspoststheme-development

Returning Loops wordpress


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();
?>

Solution

  • 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.