• I know you can easily highlight the author’s comments. However, is it possible to highlight all comments from registered users? For example, I’d like the comments from the authors to be highlighted in green, and those from other writers that are registered to be blue. Can this be done?

Viewing 13 replies - 1 through 13 (of 13 total)
  • Most likely … you might want to add a link to your blog with a specific post pointed out that would provide a good example of the comments you want to style.

    The more information you provide the better chance someone on these forums will have a quick (and easy?) answer for your question.

    Thread Starter bendrucker

    (@bendrucker)

    The blog is currently being constructed, so I don’t have anything to show what I want to do. But here’s an overview so my question is more clear. I want to create unique comment classes based on the following types of commenters:

    Author of Post: class=”postauthor”
    Writer, but not author of given post: class=”author”
    General user: Regular comment style

    wp_list_comments() automatically generates .byuser and .bypostauthor classes. If they’re not sufficient, you’ll need to look at creating a custom comment callback function.

    Thread Starter bendrucker

    (@bendrucker)

    I checked the page and did not see any of the tags you mentioned. If they were there, that would be perfect for what I’m trying to do!

    You need to examine the source of a page that is created using wp_list_comments to see all of the available classes.

    Thread Starter bendrucker

    (@bendrucker)

    I mean that I checked the source of a post page and there is no mention of the classes you referred to. Should I be looking somewhere else?

    You need to look at a page that contain comments generated using wp_list_comments.

    Thread Starter bendrucker

    (@bendrucker)

    http://www.academicperspective.com/

    There’s the URL. Could you tell me what page contains comments generated using wp_list_comments?

    None. Your theme doesn’t use wp_list_comments right now. You’d need to amend comments.php use that tag instead of it’s current comment listing.

    Thread Starter bendrucker

    (@bendrucker)

    I managed to muster up my near non-existent PHP skills and get something working. I added this php code immediately after the div class=” for the comment div.

    <?php if($comment->user_id != 0)
    {echo 'usercomment';}
    if(get_the_author_meta('ID') == $comment->user_id)
    {echo ' authorcomment';}?>

    Thread Starter bendrucker

    (@bendrucker)

    So I’ve upgraded my theme and now it uses wp_list_comments instead of the legacy method. But the .byuser and .bypostauthor aren’t appearing.

    Thread Starter bendrucker

    (@bendrucker)

    Anyone know how to make these classes appear?

    Thread Starter bendrucker

    (@bendrucker)

    Bump…

Viewing 13 replies - 1 through 13 (of 13 total)

The topic ‘Comment Styling’ is closed to new replies.