Forums
Home / Themes and Templates / How do I write this IF statement?
(@thelastknight)
15 years, 3 months ago
Right this is the slice of code that is used for my comments.
<li> <div class="meta"> <?php echo get_avatar($comment,$size='70',$default='<path_to_url>' ); ?> <?php printf(__('<cite class="fn">%s</cite>'), get_comment_author_link()) ?> </div><!-- /meta --> <div class="shout"> <?php comment_text() ?> </div> <?php }
On the top <li> I want to add an IF statement to compare the author of the article to the comment author.
<li>
I’ve tried adding
<li <?php if (comment_author() == the_author()) { echo " class=\"author\""; } ?>>
But all it does it output
<li commentauthor theauthor>
commentauthor would be the comments authors name and theauthor would be the authors name.
Any help?
I tried this
<li<?php if ($comment->comment_author_email == "myemail@example.com") { ?> class="authorcomment"<?php } ?>>
Which works, but obviously that is a defined email. So I thought just change it to this.
<li<?php if ($comment->comment_author_email == the_author_email) { ?> class="authorcomment"<?php } ?>>
But nothing?
(@thelastknight)
15 years, 3 months ago
Right this is the slice of code that is used for my comments.
On the top
<li>
I want to add an IF statement to compare the author of the article to the comment author.I’ve tried adding
But all it does it output
<li commentauthor theauthor>
commentauthor would be the comments authors name and theauthor would be the authors name.
Any help?