In order to visually enhance your blog, you should definitely consider using alternate background colors on your blog homepage where your posts are listed.
There's nothing difficult with this recipe. All you have to do is to edit the WordPress loop located in your index.php
file.
Replace your current loop with the following one:
<?php $odd_or_even = 'odd'; ?> <?php if ( have_posts() ) : while( have_posts() ): the_post(); ?> <div class="post <?php echo $odd_or_even; ?>"> <?php $odd_or_even = ('odd'==$odd_or_even) ? 'even' : 'odd'; ?> <?php the_title(); ?> <?php the_content; ?> </div> <?php endwhile; endif; ?>
Save
index.php
and openstyle.css
for editing.Add the following CSS classes to
style.css
:.post.odd{ background: blue; } .post.even{ background: red; }