Hi.
I have added this function on my functions.php
function commentCount() {
global $wpdb;
$count = $wpdb->get_var('SELECT COUNT(comment_ID) FROM ' . $wpdb->comments. ' WHERE comment_author = "' . get_comment_author() . '"');
echo $count . '';
}
And this code <?php commentCount(); ?> to call forth the Total of Comment posted by each individual Visitor.
The function above, searches for a "Name" used by a visitor when he posted his Comments, and so collects the total of comments for each unique "Name".
All works great so far!
Now... I want to create a "IF" conditions to Print a different "Title" depending on how many comments a certain Name has.
To my knowledge the variable commentCount() has the value of the current comment name... So, I would use this on my If conditions? See below...
<?php
if ($commentCount > 10) {
echo "Level 10"; }
if ($commentCount > 1) {
echo "Level 01";
}
?>
What I am trying is. IF commentCount is bigger than 10, echo "Level 10". IF commentCount is bigger than 1, echo "Level 1".
Can anyone help please?