Comments A Comment Author Made

functions.php

function commentCountAuthor(){
$oneText = ‘One comment’;
$moreText = ‘% comments’;
global $wpdb;
$result = $wpdb->get_var(‘
SELECT
COUNT(comment_ID)
FROM
‘.$wpdb->comments.’
WHERE
comment_author_email = “‘.get_comment_author_email().'”‘
);
if($result == 1):
echo str_replace(‘%’, $result, $oneText);
elseif($result > 1):
echo str_replace(‘%’, $result, $moreText);
endif;
}

template

commentCountAuthor();


Comments