Gravatars are Globally Recognized Avatars. An avatar or gravatar is an icon, or representation, of a user in a shared virtual reality, such as a forum, chat, website, or any other form of online community in which the user(s) wish to have something to distinguish themselves from other users.
To enable Gravatar in your WordPress theme’s comments, you will need to have some knowledge on editing PHP code and a little bit knowledge on WordPress architecture. The minimum requirement to allow Gravatar to work on your theme is to have WordPress running at version at least 2.5.
Open and edit the file that contains the code to generate comments (normally comments.php) in your WordPress theme folder. Find the portion of code where all comments are looped and printed out. For example:
<?php foreach ($comments as $comment) : ?> ...... <?php endforeach; /* end for each comment */ ?>
Put the following code in the portion of code above:
<?php echo get_avatar( $comment, $size = '64' ); ?>
Depending on how large is the Gravatar image you want to display on your page, you can adjust the $size = '64'
to other value (pixels). The default size if 92 pixels if you don’t specified the size value.
Read WordPress Codex for more on using Gravatar.
Nayland Smith says
Thanks a lot!!!
I was looking for this.
I hope you like my gravatar 😛
szehau says
That is a cool one!