A while back I edited a version needing updated badly. I don’t remember were I got it but this plugin seems to work fine in 2.8
The Plugin:
<?php
/*
Plugin Name: Recent Comments with Gravatar:
Version: 0.2
Description: Recent Comments with Gravatar. Editied for WordPress 2.8.0
Author: Unknown
*/
function recent_comments($g_size = 30, $no_comments = 10, $comment_lenth = 60, $show_pass_post = false) {
global $wpdb, $tablecomments, $tableposts;
$request = "SELECT ID, comment_ID, comment_content, comment_author, comment_author_email FROM $tableposts, $tablecomments WHERE $tableposts.ID=$tablecomments.comment_post_ID AND post_status = 'publish' ";
if(!$show_pass_post) { $request .= "AND post_password ='' "; }
$request .= "AND comment_approved = '1' ORDER BY $tablecomments.comment_date DESC LIMIT $no_comments";
$comments = $wpdb->get_results($request);
foreach ($comments as $comment) {
$comment_id = $comment->comment_ID;
$comment_content = strip_tags($comment->comment_content);
$comment_excerpt = mb_substr($comment_content, 0, $comment_lenth)." [...]";
$permalink = get_permalink($comment->ID)."#comment-".$comment->comment_ID;
$comment_author_email = $comment->comment_author_email;
echo '<div class="gravitar">';
echo "<p class=\"li".$comment_id."\">";
if (function_exists('get_avatar')) {
if ('' == $comment->comment_type) {
echo get_avatar($comment->comment_author_email, 40);
} elseif ( ('trackback' == $comment->comment_type) || ('pingback' == $comment->comment_type) ) {
echo get_avatar($comment->comment_author_url, 40);
}
} elseif (function_exists('gravatar')) {
echo "<img src=\"";
if ('' == $comment->comment_type) {
echo gravatar($comment->comment_author_email);
} elseif ( ('trackback' == $comment->comment_type) || ('pingback' == $comment->comment_type) ) {
echo gravatar($comment->comment_author_url);
}
echo "\" alt=\"\" class=\"avatar\" />";
}
echo "</p>\n";
echo '</div>' ;
echo '<div class="comments_exrpt">';
echo " <a href=\"" . $permalink . "\" title=\"View the entire comment\">";
echo $comment_excerpt;
echo "</a>";
echo '</div>' ;
}
}
?>
Add this to your theme:
<?php
if(function_exists('recent_comments')) {
recent_comments(30, 10, 100, false);
}
?>
css:
.comments_exrpt{margin-bottom:15px;width:260px;}
.comments_exrpt a{color:#ffc;font-family:Verdana;font-size:65.5%;}