WordPress 2.5 and Gravatars

One of the first things I noticed after I upgraded to WordPress 2.5 was that gravatars showed up in my comments admin page. WordPress had supported gravatars via plugins but now it looked like the code recognized them without intervention. Existing themes need to be tweaked to use gravatars natively so I just spent the last half hour or so tweaking my comments.php page and adjusting the style sheet. Here’s what you do (unless you prefer to read the Codex, which is recommended anyway):

  1. Add echo get_avatar($comment) to your comments.php page somewhere inside the comments loop. I recommend wrapping it in a div tag and give it a unique class for easier styling.
  2. Configure get_avatar by adding $size and $default parameters. I think it’s a good idea to self host your own default gravatar especially since the system default is a little overwhelming in my opinion.
  3. Modify your stylesheet to place the gravatar just where you want it.
  4. Go to ‘settings->discussion’ on your admin dashboard and make sure gravatars are enabled.

You can also put gravatars in your index.php page which is a nice touch if you have a multi-author blog. If this is too much ‘under the hood’ stuff, just use Dougal’s Easy Gravatars.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s