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.

1 Answer 1

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'; }
5
  • Thanks. This did not produce any output. Commented Mar 4, 2019 at 20:21
  • where did you insert it ?
    – Gregory
    Commented Mar 5, 2019 at 8:59
  • Inside of theme/library/functions/comments.php file where the actual comments are being pulled from. Commented Mar 5, 2019 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
    Commented Mar 5, 2019 at 21:04
  • You welcome, dont hesitate to valide the answear !
    – Gregory
    Commented Mar 9, 2019 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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