X

Alternate comment colors

Adding this code to your comments will allow you to alternate colors in your comments.



Code Snippet:


<?php if ( $comments ) : ?>:

<ul>
<?php
$i = 0;
foreach ($comments as $comment) :
$i++;
?>

<li id="comment-<?php comment_ID() ?>"<?php if($i&1) { echo 'class="odd"';} else {echo 'class="even"';} ?>>


Code Snippet:


.odd {background: #e5e5e5; }
.even {background: #ccc; }

Comments  Leave a Reply

  1. wp-popular.com » Blog Archive » Wordpress Alternate comment colors – wpsnipp November 17, 2010 at 12:44 am

    […] See original here: WordPress Alternate comment colors – wpsnipp […]

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!