Walker News

A capsule of walker’s experience in life…

Enable Gravatar In Wordpress Comment And Pingback

The new WalkerNews Wordpress theme is Gravatar enabled.

Turn on or display Gravatar in Wordpress comments and pingbacks
Display Gravatar in Wordpress theme.
As long as you leave a comment with email that used to create the Gravatar, WalkerNews.net automatically fetch your Avatar and show it out.

It’s not difficult to enable or display the Gravatar in Wordpress theme. Wordpress community is always not short of plugins or PHP snippet for extension.

And for WalkerNews.net theme, the PHP snippet is hack to display Gravatar for both site author’s comments and pingbacks (also display Avatar of readers).

How to enable Gravatar in Wordpress theme comments?
Display Gravatar in site author’s pingback.
Here is the PHP snippet (just a simple hack to the published code):

  1. Edit the comments.php (exists in most standard Wordpress theme)
  2. Locate the comment_text() function (normally called only once in standard comments.php template file)
  3. Remark or comment out the line with comment_text() function
  4. Paste the following PHP snippet right after the remarked comment_text() line (the blue colour PHP codes should be changed to suit your site accordingly; the red colour lines is the one commented out just now.
    <?php
    
       $authurl = substr($comment->comment_author_url,7,18);
    
       if ( !empty( $comment->comment_author_email ) ) {
    
          $md5 = md5( $comment->comment_author_email );
    
          $default = urlencode( 'http://blog.gravatar.com/wp-content/themes/vip/gravatar/logo.gif' );
    
          echo "<img style='float: right; margin-left: 10px;' src='http://www.gravatar.com/avatar.php?gravatar_id=$md5&amp;size=80&amp;default=$default' alt='Gravatar' />";
    
       } elseif ($authurl == 'www.walkernews.net') {
    
          $md5 = md5("email@walkernews.net");
    
          $default = urlencode( 'http://blog.gravatar.com/wp-content/themes/vip/gravatar/logo.gif' );
    
          echo "<img style='float: right; margin-left: 10px;' src='http://www.gravatar.com/avatar.php?gravatar_id=$md5&amp;size=80&amp;default=$default' alt='Gravatar' />";
    
       }
    
       comment_text();
    
    ?>
  5. Save the changes made in comments.php template file.

Now onwards, you’ll see Gravatar appears at the right-hand side (as per CSS style in the PHP snippet) on your own comments and pingbacks (in your own blog).

Personally, I thought to have Gravatar displayed will be useful to highlight site author’s comments and pingbacks.


Bookmark and Share:
  • Facebook
  • StumbleUpon
  • Sphinn
  • Digg
  • Pownce
  • del.icio.us
  • Live
  • Google
  • YahooMyWeb
  • Slashdot
  • Furl
  • NewsVine
  • Reddit
  • Ma.gnolia
  • TailRank
  • Technorati
  • BlinkList
  • blogmarks
  • IndianPad
  • Haohao
Topic - Internet   Search - , , , , , , , , ,

Similar Articles:
» Highlight Author Comment And Pingback In Wordpress Theme
» An Email + Thumbnail = Your Web Identity, Sir!
» Update WP_TITLE To Display Blog Name On The Right
» Display Adsense Ads Between Posts In Wordpress
» How To Display Adsense Search Result Within Wordpress Page
» How to Add Recent Comments In New Blogger Template
» How To Add ShareThis Widget In New Blogger Template

Custom Search

Latest Posts @ WalkerNews.net

↑ Grab this Headline Animator

Navigation:
» HOME - WalkerNews.net
« PREV  - WalkerNews Wordpress Theme With Tag And Gravatar
» NEXT  - Highlight Author Comment And Pingback In Wordpress Theme

2 Comments so far

  1. WalkerNews.net

    [...] Hack : I would prefer to remove the graphic in header, add in Wordpress 2.3 Tag Cloud and Post Tag, enable Gravatar feature, using brighter font color and justify text-alignment for the post [...]

  2. evathiste March 3rd, 2008 10:56 pm
    WalkerNews.net

    Hello there.
    Just found your site. Great job!
    I like it much.
    look here http://live.com

Appreciate your comments, but please be in topic.
Please use proper English with punctuation, from 12th of May 2008 onwards.
WalkerNews.net supports Gravatar (Web ID)