title: nth-child odd / even wordpress loop
body: <p>I've got a standard Wordpress loop where I want the images to float to the right and left on odd and even row numbers respectively.</p>
  
  <p>The problem I have is that the .featured:nth-child(odd) is getting applied to all the featured images floating all images to the left.</p>
  
  <p>Is it an issue with the loop? Do I need to use a foreach loop instead?
  Any help much appreciated. Thanks</p>
  
  <pre><code>&lt;?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?&gt;
  
     &lt;figure class="featured"&gt;
      &lt;img src="#" width="230" height="230"&gt;
     &lt;/figure&gt;
  
     &lt;div class="content"&gt;
          &lt;?php the_content(); ?&gt;
     &lt;/div&gt;
  
  &lt;?php endwhile; ?&gt;
  &lt;?php endif; ?&gt;
  
  
  CSS:
  .featured {
  margin: 0 0 0 20px;
  width: 228px;
  border: 1px solid #333; 
  }
  .featured:nth-child(odd){
  float: left;
  
  }
  
  .featured:nth-child(even) {
  float: right;
  
  }
  </code></pre>