Title: Several query_posts wont work..
Last modified: August 20, 2016

---

# Several query_posts wont work..

 *  Resolved [sclausen](https://wordpress.org/support/users/sclausen/)
 * (@sclausen)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/several-query_posts-wont-work/)
 * How do i get several query posts to work with my loop?
    I want to exclude the
   category, and only show 3 posts, but its only the exclude category that works..
 * My code looks like this:
 *     ```
       <?php query_posts( 'cat=-3', 'posts_per_page=3'); ?>
       <?php $i = 0; while( have_posts() ) : the_post(); $i++; ?>
   
       <div id="post" class="post-<?php echo $i; ?>">
   
       <a href="<?php the_permalink(); ?>">
       <div id="image" class="image-<?php echo $i; ?>">
       <?php the_post_thumbnail(); ?>
       </div>
       </a>
   
       <div id="excerpt" class="excerpt-<?php echo $i; ?>">
   
       <a href="<?php the_permalink(); ?>">
       <h2><?php the_title(); ?></h2>
       </a>
       <br/>
       <?php the_excerpt(); ?>
   
       </div>
       </div>
       <?php endwhile; ?>
       ```
   
 * Thanks for your help 😉

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Equal](https://wordpress.org/support/users/equalmark/)
 * (@equalmark)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/several-query_posts-wont-work/#post-2212576)
 * The `query_posts` argument would need to look like this:
 * `<?php query_posts( 'cat=-3&posts_per_page=3'); ?>`
 * [http://codex.wordpress.org/Function_Reference/query_posts](http://codex.wordpress.org/Function_Reference/query_posts)
 *  Thread Starter [sclausen](https://wordpress.org/support/users/sclausen/)
 * (@sclausen)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/several-query_posts-wont-work/#post-2212608)
 * Thanks a lot! 😉

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Several query_posts wont work..’ is closed to new replies.

## Tags

 * [query_posts](https://wordpress.org/support/topic-tag/query_posts/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [sclausen](https://wordpress.org/support/users/sclausen/)
 * Last activity: [14 years, 9 months ago](https://wordpress.org/support/topic/several-query_posts-wont-work/#post-2212608)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
