• Resolved su1

    (@su1)


    Hello,

    I’m using a customized theme and it doesn’t have the possibility to distinguish the comments made by the author of the post (like by adding the .bypostauthor class for example).

    I’m trying to find the code line that would permit me to add such a class. I think it’s present in the twentyten theme, probably in the twentyten_comment function, but I can’t spot it, can you help me please ?

    Here is the code of the twentyten_comment function:

    http://pastebin.com/fPjdKRMK

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter su1

    (@su1)

    Well I must say I have followed your link and I don’t see any reference about adding specific tags for the author’s comments.

    If you could be more specific it would be great.

    The classes are automatically added by wp_list_comments().

    in the case of the callback function in twenty ten, the css classes are (automatically) added in this line:

    <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">

    by the wordpress function comment_class() http://codex.wordpress.org/Function_Reference/comment_class

    Thread Starter su1

    (@su1)

    Thank both of you for your reply.

    The comment_class function was messing up my theme so I just added this line :

    class="<?php if ($comment->comment_author_email == "contact@mydomain.com") echo 'author'; else echo 'user'; ?>"

    and it works fine.
    Thanks for your help.

    What can I do with this line to make sure my admin highlights?

    <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">

    I tried with this one su1 had and it all went very wrong with the server.
    class="<?php if ($comment->comment_author_email == "contact@mydomain.com") echo 'author'; else echo 'user'; ?>"

    @makeupedia

    can you post a link to your site?

    what css classes are in the comment list at the moment?

    have you checked the link to the docu of comment_class() if that would output the admin.

    also, how to add extra classes to comment_class().

    what is the exact code of the full line?

    Sorry, I wasn’t aware it was big trouble, just a minor fault!

    http://www.makeupedia.se

    I think this is the full line: http://pastebin.com/a9uDkMD9

    the commentlist classes

    .commentlist li.comment
    .commentlist li:last-child
    .commentlist ol
    .commentlist .avatar
    .commentlist .even
    .commentlist .bypostauthor
    .commentlist .children
    .commentlist .children li
    .commentlist li.comment+li.pingback

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Code to tag the comments made by the author of a post’ is closed to new replies.