Alternating comment backgrounds
-
Hello all;
This is my FIRST HACK! What I did with my b2 blog is format the comments so that they were one on top of the other, but… I made it so that the background colors alternated for easy readability. I had modified this slightly to work with WordPress’s b2comments.php.
skeen’s alternating background hack
Below the first line of b2comments.php, add the following:
$bgColor = "#EEEEEE";
You would now use the $bgColor variable as the colour you wish to change your background to. Here is an example of what I did:
<span style="background-color:<?=$bgColor;?>;">
<?php comment_text() ?>
</span>
Below this, add the following code:
<?
if("#EEEEEE" == $bgColor) {
$bgColor="#DBDBDB";
}
else {
$bgColor="#EEEEEE";
}
?>
Thats it! You’re set. Your comments background color will now alternate.
- The topic ‘Alternating comment backgrounds’ is closed to new replies.