0

I have found how to highlight comments made by author of the post. However, could not achieve to attach simple text saying this is author for each comment replied by the author of the post.

0

you can compare user_id to the author id, an then add your text.

global $post;
if ( $comment->user_id === $post->post_author ) { echo 'Author'; }
  • Thanks. This did not produce any output. – Benjamin Franklin Mar 4 at 20:21
  • where did you insert it ? – Gregory Mar 5 at 8:59
  • Inside of theme/library/functions/comments.php file where the actual comments are being pulled from. – Benjamin Franklin Mar 5 at 18:25
  • i added global $post; to my answear, check and tell me if it change something. ps : also, check the output html to see if present or not ;) – Gregory Mar 5 at 21:04
  • You welcome, dont hesitate to valide the answear ! – Gregory Mar 9 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.