Showing Amount Of Comments A Comment Author Made


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function commentCountAuthor(){
  2.  
  3. $oneText = 'One comment';
  4. $moreText = '% comments';
  5.  
  6. global $wpdb;
  7.  
  8. $result = $wpdb->get_var('
  9. SELECT
  10. COUNT(comment_ID)
  11. FROM
  12. '.$wpdb->comments.'
  13. WHERE
  14. comment_author_email = "'.get_comment_author_email().'"'
  15. );
  16.  
  17. if($result == 1):
  18.  
  19. echo str_replace('%', $result, $oneText);
  20.  
  21. elseif($result > 1):
  22.  
  23. echo str_replace('%', $result, $moreText);
  24.  
  25. endif;
  26.  
  27. }

URL: http://wpcanyon.com/tipsandtricks/showing-amount-of-comments-a-comment-author-made/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.