Wordpress Tips

:

Highlight Author Comments

Wordpress Tips

Wordpress LogoThe head of Google’s Web Spam Team, Matt Cutts recently shared a nice little tip which helps to highlight the author comments in Wordpress. I find it a nice wordpress hack because, its sometimes very important for the owner of the blog to make his/her comments stand out from other.

The trick is simple:Check the user ids of the commenter to see if it’s the user id of the blog owner. Pretty smart, huh?! [Thanks to Matt cutts]

Steps Involved to Highlight Author Comments

1. Changing the theme to add an “authcomment” style – You will need to edit the style.css and near the bottom add the following lines:

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

2. Editing the comments.php file to add a little code – Go to your comments.php and find a line that should look like this:

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

Change that code according to the following example:

<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…</li>

That’s all! Now you should have a distinctive color for your own comments! Remember, you can always change the colour by simply changing the colour codes in your .css file.

Wordpress Tips

Wordpress Tips <-- Click to go to the top of the page.

Comments are closed.