Gravatar is an image that follows you from site to site appearing beside your name when you do things like comment or post on a blog. And the avatars help identify your posts on blogs and web forums. WordPress has integrated Gravatar on WordPress 2.5 and you don’t need any plugin anymore to show up your Gravatar alongside the commentator on post comment section.

If your WordPress sites don’t show up avatar for people who comment on your site, this post we would share with you how easily to implement Gravatar manually on your WordPress theme.

Enable Avatar on WordPress

First you need to enable avatar function on WordPress. Under Settings, select Discussion, at the Avatar section, select Show Avatars option, and then save changes.

Add Gravatars to WordPress Theme

Now you need to edit the theme file to add Gravatar codes. Select Appearance tab, choose Editor, and then select comments.php . Add the code below to where you want the avatars to appear. I would recommend you paste it near the commentator name. The number “25” signifies an avatar size of 25px by 25px square, you can edit this to suit the size of your current theme template.

<?php if(function_exists('get_avatar')) { echo get_avatar($comment, '25'); } ?>

Style Your Gravatar

You have to add a CSS class to style the Gravatar. Try some CSS examples below and edit it to blend with your template design. You can also use img .avatar to style the tags. Using different CSS styles, you can position or align avatars wherever you like.

#comments .avatar {
	float: right;
	margin: 0 10px; }

Get a Gravatar

If you don’t have a Gravatar, signup today for free. Almost all WordPress sites support Gravatar, it can enhance your comment visibility. For more information on how to use Gravatars on WordPress, check out WordPress Codex.

Do you like this post?

 Subscribe free via RSS, or by Email to get updates.