Highlight Admin Comments in WordPress Blog

 WordPress - Highlight Admin Comments

A while ago I was looking for such technique to highlight my own comments on my blog. After research I have got a very simple technique to perform this function. There are numbers of other techniques to perform this function. But the technique that I am describing below is simple then all others.

1. Changing my theme to add an “authcomment” style

I edited style.css and near the bottom added these lines:

.authcomment {
background-color: #B3FFCC !important;
}

2. Editing my comments.php file to add a little code

My comments.php file had a line that looked like this:

<li class=”<?php echo $oddcomment; ?>” id=”comment…

and I changed it to more or less look like this:

<li class=”<?php
/* Only use the authcomment class from style.css if the user_id is 1 (admin) */
if (1 == $comment->user_id)
$oddcomment = “authcomment”;
echo $oddcomment;
?>” id=”comment…

After saving all code reload your page to see affect of this technique.

Twitter Digg Delicious Stumbleupon Technorati Facebook

No comments yet... Be the first to leave a reply!