If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!
I use the Author Highlight Plugin to highlight which comments I have written on a post. However, when I created this, I wanted to maintain the alternate comment highlighting that I had in place before.
This is often a topic which comes up in the WordPress support forum, so how did I achieve the effect?
- Install the Author Highlight Plugin, and alter the variables in the php file. I suggest including a variable in the class_name_else field, as this helps with XHTML validation.
- Now activate the Plugin
- We now need to edit the comments.php file so that both the alternate highlighting and author highlighting work. You may already have some of this in your comments.php, but if not you can add it now.
- first of all add this before your commentblock or similar div.
<?php return; } } $oddcomment = 'alt'; ?> - Now add
<li class="<?php echo $oddcomment; >">
after
<ol id="commentlist"> <?php foreach ($comments as $comment) : ?> - now create another div under your commentlist ordered list. This will wrap all of the comment in a div that shows if the author has commented, or if it was just a blog reader.
<div class="<?php author_highlight(); ?>">
It should come above<div class="commentname">
- Now just after you close the final li tag, put the following code
<?php if ('alt' == $oddcomment){ $oddcomment = 'standard';} else {$oddcomment = 'alt';}?> <?php endforeach; /* end for each comment */ ?> - Classes have been used to define all of these variables as they can be redefined, where as ids can only be defined once as they refer to 1 specific item.
you can now style your css for the new .alt and .standard classes, and also the classes for whatever you called the author highlight.
Enjoy


No Comments
Leave a Comment »