WordPress.org

Ready to get started?Download WordPress

Forums

User Comment Count (2 posts)

  1. JobTask
    Member
    Posted 3 years ago #

    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: http://design.sparklette.net/teaches/how-to-display-user-comment-count-in-wordpress-without-a-plugin/

  2. Jam Viet
    Member
    Posted 3 years ago #

    thanks ! i am from mua sam vui and apply this code is great !

Topic Closed

This topic has been closed to new replies.

About this Topic