• Hi, I really needed some help on where exactly to post this information. I am wanting to post the comment count of each user next to their name. I found a site where it stated to put this in the functions.php section:

    function commentCount() {
    global $wpdb;
    $count = $wpdb->get_var(‘SELECT COUNT(comment_ID) FROM ‘ . $wpdb->comments. ‘ WHERE comment_author_email = “‘ . get_comment_author_email() . ‘”‘);
    echo $count . ‘ comments’;
    }

    And then to call the functions in the comment section next to the nickname.. which I have no idea what that mean:

    <?php commentCount(); ?>

    I have tried putting the code in the functions.php but it gives me an error and the entire code is visible in the top portion of my site. I’m not sure if this is the right code or if I’m doing something wrong, if this code should be replacing existing code.. or what???? Any info would be greatly appreciated.

    Here is the site I found the information: https://design.sparklette.net/teaches/how-to-display-user-comment-count-in-wordpress-without-a-plugin/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘User Comment Count’ is closed to new replies.