How to style sets of posts within the loop
-
Hi Guys,
I’m using the 960 grid for a website I’m making at the moment. I’m new to WordPress and currently trying to figure out how to show all of the posts but style them differently in sets of two, for instance…
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div class=”post post-1 alpha”>Lorem ipsum</div>
<div class=”post post-2 omega”>Lorem ipsum</div>
<?php endwhile; else: ?>
<p>Sorry, there are no posts</p>
<?php endif; ?>I need the first post to have the class “alpha” and the second post to have the class “omega”, and then loop through to the next set of posts in the same fashion. So the next posts would be:
<div class=”post post-3 alpha”>Lorem ipsum</div>
<div class=”post post-4 omega”>Lorem ipsum</div>I hope that makes sense ??
Thanks
- The topic ‘How to style sets of posts within the loop’ is closed to new replies.