Home > Mobile >  Returning Loops wordpress
Returning Loops wordpress

Time:06-02

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 >
        <a href="<?php the_permalink() ?>">
            <?php the_title(); ?>
        </a>
        <?php the_excerpt(__('(more…)')); ?>
    </div>
<?php
    endwhile;
    wp_reset_postdata();
?>

CodePudding user response:

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.

  • Related