title: Using $do_not_duplicate several times in Wordpress to avoid duplicate posts
body: <p>I wonder if you can help with what I hope is an easy-to-solve Wordpress problem?</p>
  
  <p>I've created a magazine-style theme at <a href="http://www.totalbackpacker.co.uk" rel="nofollow">http://www.totalbackpacker.co.uk</a>, which has three 'featured' stories at the top of the page, followed by most the most recent posts below.</p>
  
  <p>Using the <code>$do_not_duplicate</code> method (http://codex.wordpress.org/The_Loop#Multiple_Loops_in_Action), I've been able to omit the post that is displayed as the main featured story in the list of most recent posts ... but I run into difficulties when trying to omit the second and third featured stories, presumably because <code>$do_not_duplicate</code> is only intended to be used once.</p>
  
  <p>I'm displaying the main featured story using:</p>
  
  <pre><code>&lt;?php query_posts('category_name=editors-picks-main&amp;posts_per_page=1'); ?&gt;
  &lt;?php if (have_posts()) : ?&gt;
  &lt;?php while (have_posts()) : the_post();
  $do_not_duplicate = $post-&gt;ID; ?&gt;
  </code></pre>
  
  <p>So it's basically pulling the most recent post from the <code>editors-picks-main</code> category.</p>
  
  <p>The 'second' featured story (the most recent post from the <code>editors-picks-sub-1</code> category) is displayed using:</p>
  
  <pre><code>&lt;?php query_posts('category_name=editors-picks-sub-1&amp;posts_per_page=1'); ?&gt;
  &lt;?php if (have_posts()) : ?&gt;
  &lt;?php while (have_posts()) : the_post(); ?&gt;
  </code></pre>
  
  <p>And the 'third' featured story (the most recent post from the <code>editors-picks-sub-2</code> category) using:</p>
  
  <pre><code>&lt;?php query_posts('category_name=editors-picks-sub-2&amp;posts_per_page=1'); ?&gt;
  &lt;?php if (have_posts()) : ?&gt;
  &lt;?php while (have_posts()) : the_post(); ?&gt;
  </code></pre>
  
  <p>For the most recent posts section (note: the posts are spread over two columns, so this code is repeated) I'm using:</p>
  
  <pre><code>&lt;?php query_posts('category_name=blog&amp;posts_per_page=4'); ?&gt;
  &lt;?php if (have_posts()) : ?&gt;
  &lt;?php $count = 0; ?&gt;
  &lt;?php while (have_posts()) : the_post();
  if( $post-&gt;ID == $do_not_duplicate ) continue; ?&gt;
  &lt;?php $count++; ?&gt;
  &lt;?php if ($count == 1) : ?&gt;
  &lt;h5 class="smaller"&gt;&lt;a href="&lt;?php the_permalink(); ?&gt;" title="&lt;?php the_title(); ?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h5&gt;
  &lt;p class="editorspickssml"&gt;&lt;?php the_excerpt(); ?&gt;&lt;/p&gt;
  &lt;?php elseif ($count == 2) : ?&gt;
  Second post here
  &lt;?php elseif ($count == 3) : ?&gt;
  Third post here
  &lt;?php elseif ($count == 4) : ?&gt;
  Fourth post here
  &lt;?php endif; ?&gt;
  &lt;?php endwhile; ?&gt;
  &lt;?php endif; ?&gt;
  </code></pre>
  
  <p>Does anyone have any suggestions as to how I may be able to get this to work? I know I need to add something similar to <code>$do_not_duplicate = $post-&gt;ID; ?&gt;</code> to the code code for <code>editors-picks-sub-1</code> and <code>editors-picks-sub-2</code> ... I'm just not sure what! </p>
  
  <p>I'd be really grateful for any tips!</p>
  
  <p>Thanks in advance for your help,</p>
  
  <p>Martin</p>