WordPress.org

Support

Support » Plugins and Hacks » Top Commentators Widget » [Plugin: Top Commentators Widget] How show inside post?!

[Plugin: Top Commentators Widget] How show inside post?!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Lorna Timbah

    @webgrrrl

    Go to Appearance / Widgets, and find in the TCW settings the section called Show in home page only. Set that to No.

    I learned | must edit ‘function.php’ >>

    function top_comment_authors($atts, $content = null) {
        extract(shortcode_atts(array(
            "amount" => '5'
        ), $atts));
        global $wpdb;
        $results = $wpdb->get_results('
            SELECT
            COUNT(comment_author_email) AS comments_count, comment_author_email, comment_author, comment_author_url
    
            FROM
            '.$wpdb->comments.'
    
            WHERE
            comment_author_email != "" AND comment_type = "" AND comment_approved = 1
    
            GROUP BY
            comment_author_email
    
            ORDER BY
           comments_count DESC, comment_author ASC
            LIMIT '.$amount
        );
        $screen = "<ul>";
    
        foreach($results as $result){
    
            $screen .= '<li class="top_commentators"><a title="' . $result->comment_author_url . '" href="' . $result->comment_author_url . '" target="_blank" rel="nofollow">' . get_avatar( $result->comment_author_email, $size = '30', '', 'avatar' ) . $result->comment_author . '</a> [' . $result->comments_count . ']</li>';
        }
    
        $screen .= "</ul>";
    
        return $screen;
    }
    
    add_shortcode("top_commentators", "top_comment_authors");

    shortcode = [top_commentators amount=X]

    Plugin Author Lorna Timbah

    @webgrrrl

    Those codes are not from the Top Commentators Widget that you linked here. You must be referring to codes similar to this.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Top Commentators Widget] How show inside post?!’ is closed to new replies.
Skip to toolbar