{"id":23,"date":"2005-01-12T01:38:58","date_gmt":"2005-01-12T06:38:58","guid":{"rendered":"http:\/\/lee.org\/blog\/archives\/2005\/01\/12\/alternating-colors-for-comments\/"},"modified":"2005-01-23T21:58:01","modified_gmt":"2005-01-24T02:58:01","slug":"alternating-colors-for-comments","status":"publish","type":"post","link":"https:\/\/www.lee.org\/blog\/2005\/01\/12\/alternating-colors-for-comments\/","title":{"rendered":"Alternating Colors for Comments"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/lee.org\/blog\/images\/20050110-alternating-colored-comments.png\" width=\"200\" height=\"205\" align=\"right\" \/>I snagged this nice idea from <a href=\"http:\/\/gfmorris.org\/archives\/2004\/07\/29\/alternating-comment-classes\/\">gfmorris<\/a>  about how to make comments in WordPress stand out from one another. I changed the code a little because his quotes didn&#8217;t work for me.<\/p>\n<p>Starting at about line 37, add the items in red to wp-comments.php:<\/p>\n<p><code>&lt;?php <font color=\"#FF0000\">$j=0;<\/font> foreach ($comments as $comment) { ?&gt;<br \/>\n&lt;li id=&quot;comment-&lt;?php comment_ID() ?&gt;&quot; <font color=\"#FF0000\">&lt;?php if($j%2) {echo &quot;&lt;div class=&quot;comment-even&quot;&gt;&quot;;} else {echo &quot;&lt;div class=&quot;comment-odd&quot;&gt;&quot;;} $j++; ?&gt;<\/font><\/code><\/p>\n<p>Finally, put these in your wp-layout.css<\/p>\n<p><code>.comment-even {background: #CECECE;}<br \/>\n.comment-odd {background: #F0F0F0;}<\/code><\/p>\n<p>An example of what you might get out of this is in the neighboring image.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I snagged this nice idea from gfmorris about how to make comments in WordPress stand out from one another. I changed the code a little because his quotes didn&#8217;t work for me. Starting at about line 37, add the items in red to wp-comments.php: &lt;?php $j=0; foreach ($comments as $comment) { ?&gt; &lt;li id=&quot;comment-&lt;?php comment_ID() [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-23","post","type-post","status-publish","format-standard","hentry","category-wordpress"],"_links":{"self":[{"href":"https:\/\/www.lee.org\/blog\/wp-json\/wp\/v2\/posts\/23","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lee.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lee.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lee.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lee.org\/blog\/wp-json\/wp\/v2\/comments?post=23"}],"version-history":[{"count":0,"href":"https:\/\/www.lee.org\/blog\/wp-json\/wp\/v2\/posts\/23\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.lee.org\/blog\/wp-json\/wp\/v2\/media?parent=23"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lee.org\/blog\/wp-json\/wp\/v2\/categories?post=23"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lee.org\/blog\/wp-json\/wp\/v2\/tags?post=23"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}