SimonDorfman
Member
Posted 4 years ago #
I'm using WP 1.5 and a hacked up version of the Kubrick theme. I changed the code exameple here:
http://blog.deconcept.com/2004/11/13/wordpress-author-comment-highlighting/
...so it works with the alternate highlighting in Kubrick. In the comments.php file replace this (should be line 29):
<li class="<?php echo $oddcomment; ?>" id="comment-<?php comment_ID() ?>">
...with this line:
<li class="<?php if ($comment->comment_author_email == "you@youraddress.com") echo 'mycomment'; else echo $oddcomment; ?>" id="comment-<?php comment_ID() ?>">
Then add this to your syle.css:
li.mycomment {
background-color: #FFFFF7;
border: solid 1px #5B0100;
}
Works fine for me. See it in practice here:
http://simondorfman.com/Games/Spellfire/2005/03/12/to-the-pain-thieves-deck/#comments
sithicus
Member
Posted 4 years ago #
can we nest an if this for two authors?
sithicus
Member
Posted 4 years ago #
sithicus
Member
Posted 4 years ago #
This is how I addapted it for two authors :)
Then of course make your style sheets different.
<li class="<?php if ($comment->comment_author_email == "email1@gmail.com") echo 'christopher'; else if ($comment->comment_author_email == "email2@gmail.com") echo 'christine'; else echo $oddcomment; ?>" id="comment-<?php comment_ID() ?>">
obeattie
Member
Posted 3 years ago #
Is there a way of doing this by fetching the author's email direct from WordPress?
silencematters
Member
Posted 3 years ago #
Is there a way of doing this by fetching the author's email direct from WordPress?
Great question. I would like to be able to do the same!- jeremy
silencematters
Member
Posted 3 years ago #
What if you have 20+ writers on a blog? it wouldnt make sense to go into comments.php each time I have a new user, right? I bet there is a more efficient way.
Mod to Simon's original:
<li class="<?php if ( $comment->comment_author_email == get_the_author_email() ) echo 'authorcomment'; else echo $oddcomment; ?>" id="comment-<?php comment_ID() ?>">
Change the .mycomment class to .authorcomment in the css.
Thanks Kaf, I was looking at the functions on how to do this, and thought, maybe it's already been asked in the forums, and lo and behold, it had. Worked like a charm.