Title: Multiple loops avoiding duplicate posts
Last modified: August 19, 2016

---

# Multiple loops avoiding duplicate posts

 *  [digitalminds](https://wordpress.org/support/users/digitalminds/)
 * (@digitalminds)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/multiple-loops-avoiding-duplicate-posts/)
 * I’m customizing the index.php file because I wanted to show posts on the frontpage
   with a different markup. This is what I’m trying to reach:
 * 1 full post (the most recent post)
    2 exercpts of te next to posts in two columns
   3 a list with titles of the next 3 posts
 * Does anyone know how to get this? I tried some multiple loops but they didn’t
   brought me further than a blank page in my browser while testing.

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

 *  [Jess](https://wordpress.org/support/users/jessn/)
 * (@jessn)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/multiple-loops-avoiding-duplicate-posts/#post-1323774)
 * This might help you:
    [http://perishablepress.com/press/2008/09/01/multiple-loops-and-multiple-columns-with-wordpress/](http://perishablepress.com/press/2008/09/01/multiple-loops-and-multiple-columns-with-wordpress/)
 * Have the first loop only pull up one post (showposts=1)
 * Have the second loop only pull up two posts, with an offset of one to ignore 
   the post above (showposts=2&offset=1). Then instead of the_content use the_excerpt
 * Have the third loop show three posts with an offset of three (showposts=3&offset
   =3) and don’t show the_content, just the_title.
 *  [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * (@vtxyzzy)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/multiple-loops-avoiding-duplicate-posts/#post-1323799)
 * You will need an adaptation of the [‘mullet loop’](http://perishablepress.com/press/2007/11/14/easily-adaptable-wordpress-loop-templates/).
 * You will need something like:
 *     ```
       <?php if (have_posts()) : ?>
          <?php $count = 0; ?>
          <?php while (have_posts()) : the_post(); ?>
             <?php $count++; ?>
             <?php if ($count == 1) : ?>
   
                // if this is the first post, process any code that is specified in this region
                // process any code specified in this region before the content of the first post
   
                <?php the_content(); ?> // display the full content of the first post only
   
                // process any code specified in this region after the content of the first post
   
             <?php elseif ($count < 4) : ?>
   
                // if this is the second or third post, process any code that is specified in this region
                // process any code specified in this region before the content of the second or third post
   
                <?php the_excerpt(); ?> // display the excerpt of the second and third posts
   
                // process any code specified in this region after the second and third posts
   
             <?php else : ?>
   
                // if this is fourth or more post, process any code specified in this region
                // process any code specified in this region before the content of each post
   
                <?php the_title(); ?> // display only the title for all other posts
   
                // for all posts after the third, process this code below each post
   
             <?php endif; ?>
   
             // for each post, including the first, process any code included here
             // any code output will be displayed below the content of every post
   
          <?php endwhile; ?>
       <?php endif; ?>
       ```
   
 *  [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * (@t31os_)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/multiple-loops-avoiding-duplicate-posts/#post-1323852)
 * Or in the most basic terms, a standard loop with a counter… 😉
 * Never could understand the name… How does mullet relate?.. At least if we called
   it The Sesame Street loop we could have some form of relation between counting
   and the name.. 🙂
 * I’m just rambling randomly of course, you can just ignore me.. 🙂
 *  Thread Starter [digitalminds](https://wordpress.org/support/users/digitalminds/)
 * (@digitalminds)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/multiple-loops-avoiding-duplicate-posts/#post-1323893)
 * Many thanks you guys! It’s working. For other people, the code is as following:
 *     ```
       <?php get_header(); ?>
   
       	<?php if (have_posts()) : ?>
   
       		<?php while (have_posts()) : the_post(); ?>
   
       <?php query_posts('showposts=1'); ?>
       <?php $posts = get_posts('numberposts=1&offset=0'); foreach ($posts as $post) : start_wp(); ?>
       <?php static $count1 = 0; if ($count1 == "1") { break; } else { ?>
   
       <?php the_title(); ?>
       <?php the_excerpt(); ?>
   
       <?php $count1++; } ?>
       <?php endforeach; ?>
   
       <div id="leftpost">
       <?php query_posts('showposts=1'); ?>
       <?php $posts = get_posts('numberposts=1&offset=1'); foreach ($posts as $post) : start_wp(); ?>
       <?php static $count2 = 0; if ($count2 == "1") { break; } else { ?>
   
       <?php the_title(); ?>
       <?php the_excerpt(); ?>
       <?php $count2++; } ?>
       </div>
       <?php endforeach; ?>
   
       <div id="rightpost">
       <?php query_posts('showposts=1'); ?>
       <?php $posts = get_posts('numberposts=1&offset=2'); foreach ($posts as $post) : start_wp(); ?>
       <?php static $count3 = 0; if ($count3 == "1") { break; } else { ?>
   
       <?php the_title(); ?>
       <?php the_excerpt(); ?>
   
       <?php $count3++; } ?>
       </div>
       <?php endforeach; ?>
   
       <ul>
       <?php query_posts('showposts=7'); ?>
       <?php $posts = get_posts('numberposts=7&offset=3'); foreach ($posts as $post) : start_wp(); ?>
       <?php static $count4 = 0; if ($count4 == "7") { break; } else { ?>
   
       <li><a class="" href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
   
       <?php $count4++; } ?>
   
       <?php endforeach; ?>
       </ul>  
   
       		<?php endwhile; ?>
   
       	<?php else : ?>
   
       		<h2><?php _e('The page you<code>re looking for doesn</code>t exist', 'blank'); ?></h2>
       		<div class="search-404">
       		<?php _e('Do you want to search for it?', 'blank'); ?><br />
       		<?php include (TEMPLATEPATH . "/searchform.php"); ?>
       		</div>
   
       	<?php endif; ?>
   
       <?php get_sidebar(); ?>
   
       <?php get_footer(); ?>
       ```
   
 *  [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * (@vtxyzzy)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/multiple-loops-avoiding-duplicate-posts/#post-1323916)
 * Mullet – as in hair style that trails off long in the back – maybe?
 * Please mark this topic ‘Resolved’.
 *  [quemultimedia](https://wordpress.org/support/users/quemultimedia/)
 * (@quemultimedia)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/multiple-loops-avoiding-duplicate-posts/#post-1324122)
 * Greetings Guys,
 * Is it possible to implement the above ‘Mullet-Loop’ into different categories?
 * i.e. the first loop to show 4 posts from category 1, the second loop to show 
   3 posts from category 2, the third loop to show posts from yet another category
   and so on.
 * I will greatly appreciate if someone would point me in the correct direction,
   have been going round in loops myself!
 * Regards
    Q {newbie to WordPress}

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

The topic ‘Multiple loops avoiding duplicate posts’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 6 replies
 * 5 participants
 * Last reply from: [quemultimedia](https://wordpress.org/support/users/quemultimedia/)
 * Last activity: [15 years, 11 months ago](https://wordpress.org/support/topic/multiple-loops-avoiding-duplicate-posts/#post-1324122)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
