Skip to content

Instantly share code, notes, and snippets.

@Kaiderella
Created April 6, 2017 05:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kaiderella/c2e247b0a1f55827ccda56c9a0085089 to your computer and use it in GitHub Desktop.
Save Kaiderella/c2e247b0a1f55827ccda56c9a0085089 to your computer and use it in GitHub Desktop.
Comments count for wpdiscuz
add_filter('wpdiscuz_comment_author', 'my_commentCount', 10, 2);
function my_commentCount($author_name, $comment) {
global $wpdb;
$count = $wpdb->get_var('SELECT COUNT(comment_ID) FROM ' . $wpdb->comments. ' WHERE comment_author_email = "' . addslashes($comment->comment_author_email) . '"');
return $author_name .' | <span class="wpdiscuz-comment-count">'. $count . ' comments</span>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment