Support

[sticky] [closed] WordPress Tips (241 posts)

Languages

de | fr | es | 日本語

About This Topic

Tags

  1. rss milo

    moderator


    rss Posted 1 year ago
    #

    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();

Topic Closed

This topic has been closed to new replies.

Design by milo

Milo designs web sites that strike the perfect balance between professional high-class graphics, functionality, usability, user experience, and high performance.