It`s what they say :copy these code to sidebar.php
Code:
<h3><?php _e('Recent Comments'); ?></h3> <ul class="recentcomments"> <?php $my_email = "'" . get_bloginfo ('admin_email') . "'"; $rc_comms = $wpdb->get_results(" SELECT ID, post_title, comment_ID, comment_author, comment_author_email, comment_content FROM $wpdb->comments LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID = $wpdb->posts.ID) WHERE comment_approved = '1' AND comment_type = '' AND post_password = '' AND comment_author_email != $my_email ORDER BY comment_date_gmt DESC LIMIT 10 "); $rc_comments = ''; foreach ($rc_comms as $rc_comm) { $a = 'avatar/'.md5(strtolower($rc_comm->comment_author_email)).'.jpg'; $rc_comments .= "<li><img src='" . $a . "' alt='' title='" . $rc_comm->comment_author . "' class='avatar' /><a href='" . get_permalink($rc_comm->ID) . "#comment-" . $rc_comm->comment_ID //. htmlspecialchars(get_comment_link( $rc_comm->comment_ID, array('type' => 'comment'))) . "' title='on " . $rc_comm->post_title . "'>" . strip_tags($rc_comm->comment_content) . "</a></li>\n"; } $rc_comments = convert_smilies($rc_comments); echo $rc_comments; ?> </ul>
first name a folder "avatar" at the same level as directory wp-content ,set 755.Use a default.jpg as the default gravatar
find function mytheme_comment($comment, $args, $depth) in comments.php or functions.php as this
Code:
<?php echo get_avatar($comment,$size='50',$default='<path_to_url>' ); ?>
Code:
<?php $f = md5(strtolower($comment->comment_author_email)); $a = get_bloginfo('wpurl'). '/avatar/'. $f. '.jpg'; $e = ABSPATH. 'avatar/'. $f. '.jpg'; $t = 1209600; // 14 days $d = get_bloginfo('wpurl'). '/avatar/default.jpg'; if ( !is_file($e) || (time() - filemtime($e)) > $t ){ $r = get_option('avatar_rating'); $g = 'http://www.gravatar.com/avatar/'. $f. '?s=50&d='. $d. '&r='.$r; copy($g, $e); $a = esc_attr($g); } if (filesize($e) < 500) copy($d, $e); ?> <img src='<?php echo $a ?>' alt='' />
I don`t want to ues plugin WP-RecentComments and gravatar cache .please help me
I also hope in new version the BFA Recent Comments can be more beautful.