Applying a class to the first and last post of each row!
-
I’m building a wodpress theme using the 960 grid system. I’ve got a startpage that displays three thumbnails on each row. These thumbnails are in a child grid with parent wrapper.
So, I need to wrap the first post of each row with a class called “alpha” and the last post (third in my case) of each row with a class called “omega”.
Any idea how I might solve this?
Here’s my current code, any help is appreciated!
<?php get_header(); ?> <div class="grid_12 projects"><!-- PROJECTS BEGINS --> <?php if (have_posts()) : while (have_posts()) : ?> <div class="grid_4 project"> <?php the_post(); ?> <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"> <?php the_post_thumbnail(); ?> </a> <h2> <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"> <?php the_title(); ?> </a> </h2> </div><!-- PROJECT ENDS --> <?php endwhile; endif; ?> </div><!-- PROJECT-CONTAINER ENDS --> <?php get_footer(); ?>
- The topic ‘Applying a class to the first and last post of each row!’ is closed to new replies.