WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Limit While have_posts to 3 posts (1 post)

  1. anderskitson
    Member
    Posted 3 years ago #

    For the code below how would I limit the amount of posts shown to 3?
    UPDATE
    Found what I needed to do I needed to add this line
    <?php query_posts('posts_per_page=1');?>my while loop.

    <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
    <? if ($post->ID != $featured_ID) { ?>
    <h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
    <small>on <?php the_time('M d'); ?> in <?php the_category(', '); ?> tagged <?php the_tags(''); ?> by <?php the_author_posts_link(); ?></small>
    <?php the_excerpt(); ?>
    <div class="separator biggap"></div>
    <? } ?>
    <?php endwhile ?>
     <?php endif; ?>

Topic Closed

This topic has been closed to new replies.

About this Topic