Add the CSS

Open your theme css file, and paste this at the bottom:
.color1 {
background-color: #DBDBDB;
}
.color2 {
background-color: #EEEEEE;
}

Now you need to check that your CSS does not have a style that will override what you have done.
If your theme has a colour for #commentbox (for example) then you must remove the background-color line. If you don't then the change won't happen.

Comments.php

You are going to edit the comments.php file so first be sure you have a backup.

Login - Presentation - Theme Editor - Comments file

At the VERY top of this file, put this on a line of it's own.
<?$i;?>

Now scroll down to find this part of the code
Example One:
<?php foreach ($comments as $comment) : ?>
<div class="commentbox">
<div class="commentid">

Or you might have something like this
Example Two:
<?php foreach ($comments as $comment) : ?>
<li id="comment-<?php comment_ID() ?>">
<?php comment_text() ?>

You need to add the class of css to the above.

Your theme might not have these specific lines, but you need to do the next change in the same area of comments.php. If you cannot figure it out, post to the Support Forums but you MUST say what theme you are using. Without that information your chances of an answer are zero.

Changing comments.php

Using the examples above:

Example One becomes:
<?php foreach ($comments as $comment) : ?>
<div id="commentbox" class="<?=($i%2)?"color1":"color2";$i++;?>">
<div class="commentid">

Example Two becomes:
<?php foreach ($comments as $comment) : ?>
<li id="comment-<?php comment_ID() ?>" class="<?=($i%2)?"color1":"color2";$i++;?>">>
<?php comment_text() ?>
Now that should work.

Apologies if the above does not work immediately. Any differing solutions mentioned in the forums I'll bring over here.

The credit for the code above goes to Cine who posted to the forums in April 2004.

 

These pages are independent of http://wordpress.org
All design, content & images © Mark 2004-2008. All rights reserved.