WordPress.org

Ready to get started?Download WordPress

Forums

Limit numer of posts per page + exclude category (2 posts)

  1. dadra
    Member
    Posted 2 years ago #

    On my home page I have restricted the number of recent posts displayed using query_posts('posts_per_page=2')

    I would like to also exclude a category but can't figure out how to integrate the two modifications to the loop.

    Here's my code:

    <?php query_posts('posts_per_page=2'); if (have_posts()) : while (have_posts()) : the_post();?>
    
       <div class="date">Posted <?php the_time('F jS, Y') ?></div>
       <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
       <?php the_content('Continue Reading →'); ?>
    
    <?php endwhile; endif; wp_reset_query();?>

    I've tried following a few different tutorials but can't get them to work.

    Thanks in advance!

  2. kmessinger
    Volunteer Moderator
    Posted 2 years ago #

    There is an excluder plugin AFAIK.

Topic Closed

This topic has been closed to new replies.

About this Topic