Skip to content

Instantly share code, notes, and snippets.

@Manoz
Created October 24, 2014 22:39
Show Gist options
  • Save Manoz/f6c65f7b20430424639f to your computer and use it in GitHub Desktop.
Save Manoz/f6c65f7b20430424639f to your computer and use it in GitHub Desktop.
WordPress: check if the comment author is the post author.
<?php
/**
* By default, WordPress add a .bypostauthor class on comments
* I prefer echo something to have a better control in CSS.
* Exemple: http://codepen.io/Creaticode/full/ijExL
*/
global $post;
if ( $comment->user_id === $post->post_author ) {
echo '<span class="is-author">Author</span>';
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment