The Right Way Highlight Author Comments in WordPress


Sponsored Links




This Tricks original written by AEXT.net and we only share and to make it more clearly, especially for me. How To Highlight Author Comments in WordPress in the right way.

Highlight Author Comments in WordPress

Highlight Author Comments in WordPress

This code is better for the future and better for scalability such as, if you has more than one author in your WordPress site.

Write down Highlight Author Comments Code below

<li class="comment-container
    <?php
        $authID=get_the_author_meta('ID');
        if($authID == $comment->user_id)
            $oddcomment = 'authcomment';
        echo $oddcomment;
    ?>"  id="comment-<?php comment_ID(); ?>">
        ...

</li>

Please note, this code above only sample, you’ll need full code on your comment template to make it work, I’m only put on the first area on the WordPress Comment Loop and the closed tags. Then you’ll need to add CSS on your style.css

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

The Good news is, if you have new version WordPress Comment Loop, you only need added some CSS on your style.css

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

And done, so if you are the author on current article and added some comment or reply, you comment will be styling differently. I hope this sample make it clear.

Subscribe to Full RSS Feed

RSS FeedIf you thing this article useful, please consider subscribing to our RSS Feed or e-mail updates and stay updated with us. You can also follow @WPTricksNet on twitter for latest updates.

About WP Tricks

We are WordPress Family, we collected and writed useful tips and tricks for you WordPress. We share it for you...

Related Tips and Trick from Local Data and on The Net

Highlight Author Comments in WordPress, The Easier Right Way

I just came across a post published today which goes over the right way to highlight author comments in WordPress. Basically, instead of the usual code that Read More

How to highlight author comments in WordPress

How to highlight author comments in WordPress. by Matt Brazell’s way is a little nicer, if you want to highlight just the author’s comments. me on the right track Read More

Highlight Author Comments in WordPress » Aonach Internet Strategy

In the comments of her post there is also a way to add an author image. 10 Responses to “Highlight Author Comments in WordPress” for leading me in the right Read More

Change Your WordPress Author Name…Please | Theme Lab

Highlight Author Comments in WordPress, The Easier Right Way by Leland | 7 Comments; You Don’t Need a Blog On Your Front Page by Leland | 14 Comments Read More

WordPress How-To: Styling Author Comments — Spoonfed Design

This guest post on how to highlight author comments in WordPress was This way we wanted to show you how exactly you can style comments even for your very special Read More


9 Responses to The Right Way Highlight Author Comments in WordPress

  1. Pingback: Tweets that mention How To Highlight Author Comments in WordPress # WordPress Tricks & Tips -- Topsy.com

  2. Pingback: uberVU - social comments

  3. Pingback: WP Tutorial: Remove admin name in comments class | Silver Blog

  4. Pingback: WP Tutorial: Remove admin name in comments class | Unlock IMEI Cellphones

  5. Mohsen says:

    Hi
    you saved me. thank you.

  6. TerapiUrin says:

    hmm.. when i change my template i need to include those codes again n again.. is there any comment highlighter that is compatible with wp 3.0?

  7. Pingback: wp-popular.com » Blog Archive » How To Highlight Author Comments in WordPress # WordPress Tricks & Tips

  8. SQL training says:

    I’m into learning word press now because our company trains us how to use word press. And it’s a good thing that I have crossed your website. Thank you for posting this!

  9. Geekyard says:

    Great hack :) Working fine… Now all my comments looks cool ;)

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>