Title: multiple loops
Last modified: August 18, 2016

---

# multiple loops

 *  [lum](https://wordpress.org/support/users/lum/)
 * (@lum)
 * [19 years, 6 months ago](https://wordpress.org/support/topic/multiple-loops-2/)
 * Hi, I want to have 2 loops on my index page. The first one has to show 4 post
   form a certain category, and the second one 10 post from another category.
    I’ve
   tried with query_post and $my_query, but they don’t seems to work. This is how
   my code looks like:
 * `<?php query_posts('category_name=appuntamenti&showpost=4'); ?>
    <?php while (
   have_posts()) : the_post(); ?> <div class="headlines">  <?php the_time('d/m/Y')?
   >  &nbsp;<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link
   to <?php the_title(); ?>">  <?php the_title(); ?>  </a></div>  </div>  <?php 
   endwhile;?> <!-- loop 2-->  <div class="loop"><img src="http://demon.wererabbit.
   net/wp-content/themes/demon/images/notiziepubbliche.gif"></div>  <?php query_posts('
   category_name=notizie&showpost=10'); ?> <?php while (have_posts()) : the_post();?
   > <div class="post" id="post-<?php the_ID(); ?>">  <h1><a href="<?php the_permalink()?
   >" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">  <?php the_title();?
   >  </a></h1>  <?php the_time('F jS, Y') ?>  <!-- by <?php the_author() ?> -->
   <div class="entrytext">  <?php the_excerpt('Read the rest of this entry &raquo;');?
   >  </div>  </div>  <?php endwhile; ?>

Viewing 1 replies (of 1 total)

 *  [Samuel B](https://wordpress.org/support/users/samboll/)
 * (@samboll)
 * [19 years, 6 months ago](https://wordpress.org/support/topic/multiple-loops-2/#post-475799)
 * Have a read here:
    [http://codex.wordpress.org/The_Loop#Multiple_Loops](http://codex.wordpress.org/The_Loop#Multiple_Loops)
   There are examples of multiple loops and excluding categories.

Viewing 1 replies (of 1 total)

The topic ‘multiple loops’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [Samuel B](https://wordpress.org/support/users/samboll/)
 * Last activity: [19 years, 6 months ago](https://wordpress.org/support/topic/multiple-loops-2/#post-475799)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
