Wordpress Themes - WP Forum at BFA
Click Here To DONATE! Support the theme development, get more attention and additional benefits based on your donation level. Your forum name will be highlighted.

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Center area post/pages » Comments, trackbacks & pings »

recent comments and gravatar


Build custom WP THEMES, without
coding.
Click here for THEMEFRAME

From the author of Atahualpa, the #1 most
downloaded (700,000+) theme @ wordpress.org
  #1  
Old Jul 18, 2010, 09:29 PM
ylsnuha
 
9 posts · Jul 2010
hi,I want to change the Recent Comments code ,make it like the plugin WP-RecentComments.baceuse I think the BFA Recent Comments is not so easy to read and I can`t have the Gravatar. So I find these codes,they woked well on other theme,but I don`t know where to insert in this theme. ok, the codes are here
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>
and this code include the Gravatar cache,the codes:
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>'  ); ?>
and changed to
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='' />
ok.codes are here,but I don`t know where I can insert
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.
  #2  
Old Jul 19, 2010, 12:57 PM
lmilesw's Avatar
lmilesw
 
10,113 posts · Jul 2009
Central New York State USA
Why not style the BFA Recent Comments widget or turn off the avatar function on the WP-RecentComments widget? Adding code to the theme files is something I try to never do unless it's a bug fix as later upgrades are more cumbersome.
__________________
~Larry (CNY Web Designs)
This site should be a membership site since it so full of good stuff.
Please consider donating which gives you access to even more good stuff.

Bookmarks

Tags
gravatar, recent comments

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to change the # of recent comments that show up? macgig Page & Category Menu Bars 4 Jun 16, 2010 09:49 PM
[help]cannot get 'on' translated in bfa-recent-comments jokkiebo Languages & Translations 1 Apr 22, 2010 05:53 AM
Recent Comments widget: possible bug in linking of new comments Jozefs Sidebars & Widgets 3 Jan 6, 2010 11:06 AM
[SOLVED] BFA Recent Comments Tammy Sidebars & Widgets 4 Jul 22, 2009 09:43 AM
[SOLVED] Gravatar not showing on Recent Comments widget jankph Comments, trackbacks & pings 2 Jul 13, 2009 05:59 AM


All times are GMT -6. The time now is 11:01 AM.


Powered by vBulletin® Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.