How to WordPress K2 highlight Author in Comments
Sometimes an article gets more than just a few comments and you want to show when the author of the article writes a comment. On K2 you do not need a plugin! I show you how to change color and to install the WordPress plugin Authorhighlight if you do not use K2.
How to install and configure the WordPress plugin Authorhighlight
On the K2 theme you just need to change a peace of code or copy this in your own style.css
[source:php]li.bypostauthor {
background: #b5adff;
}
li.bypostauthor blockquote {
color: #333;
}[/source]
You can use for example:
- color – for textcolor
- backround – for background-color
- border: 1px solid #CCCCCC;
- …
——————-
If you do not have the K2 theme you can install authorhighlight like that:
1. Download authorhighlight, edit, upload and activate it.
[source:php]“class_name_highlight” => “highlighted”,
“class_name_else” => “”,
“email” => “email@gmx.de”,
“author” => “Tim”[/source]
2. Edit the comments.php on your WordPress theme.
2.1 Put this peace of code at the start of comments.php
[source:php]<?php author_highlight(); ?>[/source]
2.2 Put the code at the same position as here (I use the k2 as example):
[source:php]<?php foreach ($comment_list as $comment_index => $comment) { ?>
<!– Edit authorhighlight k2 –>
<div class=”<?php author_highlight(); ?>”>
<!– / –>
<li id=”comment-<?php comment_ID(); ?>” class=”<?php k2_comment_class($comment_index); ?>”> [/source]
…..
[source:php]<div class=”comment-content”>
<?php comment_text(); ?>
</div>
<?php if (’0′ == $comment->comment_approved) { ?><p class=”alert”><strong><?php _e(’Your comment is awaiting moderation.’,'k2_domain’); ?></strong></p><?php } ?>
</li>
<!– Edit authorhighlight –>
</div>
<!– / –> [/source]
2. 3 edit your style.css I prefer to edit my own custom style under …/style/tim/tim.cess
[source:php]/* ————– EDIT Autorhighligh ————– */
.highlighted
{ background-color: #c1d0e3; } [/source]
So thats it. Now the comments of the author has his own css class that you can give colors …. You can bring in what you want. If you like this how to for authorhighlight for your theme read more next time
Comments
4 Responses to “How to WordPress K2 highlight Author in Comments”
Leave a Reply

[...] all the details here [...]