Highlight Author Comments in WordPress

While we were busy linking to a site’s post, responding and leaving comments, we might wonder amongst all those comments, which are the authors comments and which are visitors comments. It should be easy to differentiate the two sides. If you have a wordpress website, this can be done easily using simple wordpress hacks.

  1. Simply locate a file named comments.php in your theme file (we assume you already know what files are inside your theme. You will need a html/php editor like Notepad++ or dreamweaver to edit the file). Double click the file comments.php to open it.
    Inside you will find arrays of codes. Immediately find a line of codes that look like this:

    <li class=”<?php echo $oddcomment; ?>” id=”comment… 
  2. And just modify it to 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… 
  3. Then to change your theme to add an “authcomment” style, locate the theme stylesheet (style.css) and click to open it using the editor.
    At any line, add these code:

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

Click save to both file comments.php and style.css. Go and try to look at your comments page. See if the color suits your wordpress site. That’s it!

Share & Save!

  • Share/Bookmark

Subscribe! (free)

Related Posts:


More Reading Materials

Be the first to comment.

Leave Comment