PHP Magic Book – Free PHP Scripts, Tutorials and Downloads, PHP AtoZ Reloaded, free php tutorials, free php downloads, php scripts, PHP tips

Change Default WordPress Gravatar in Comments

If you use a plugin to add avatars to your blog, there might be a setting in the plugin’s options page for choosing the default avatar. If you use WordPress 2.5+, then you probably use a template tag like the following for your avatars.

<?php echo get_avatar( $comment, 32 ); ?>

You can easily modify this code to show a default customized gravatar to appear if the comment author has no gravater to show.

Just add a comma after the 32 (The pixel size of the image, if you want to change that while you’re at it!), and paste in the URL to your image. e.g.

<?php echo get_avatar( $comment, 80, 'http://www.yourblogaddress.com/my-gravatar.jpg' ); ?>

Now the comments on your posts will have a much nicer image that draws less attention, promotes recognition of your logo, and as so few blogs have a unique default avatar, it shows your attention to detail.

  • Share/Bookmark
Posted in: Hacks, WordPress
Post's RSS » RSS 2.0
Post's Comments RSS » RSS 2.0

Related Posts




One Response to “Change Default WordPress Gravatar in Comments”

  1. Jan 5, 2010
    Obtaitavell Says:

    It is very interestingly written, to the author thanks.

Post a Comment

  Subscribe Via RSS
  Subscribe Via Email