So you have heard that WordPress 2.5 has a built-in Gravatar feature? So you have tried enabling it on the Administration Settings (Settings->Discussion->Show Avatars) but no pictures are being displayed at all?
I was on the same boat like you. Do you know that you still have to insert a code snippet on your comments.php (theme file)? And..No, this is not an April Fools’ Day post :)
How to enable the WordPress 2.5 Built-in Gravatar
First of all, make sure that the feature is enabled on the Administration-Settings-Discussion:
Then, go to your Design->Theme Editor and then open/edit your Comments (comments.php) file.
Find this line somewhere on the middle of the codes:
…<?php if ( $comment->comment_author_email == get_the_author_email() ) echo ‘mycomment’; else echo $oddcomment; ?>” id=”comment-<?php comment_ID() ?>”>…
…..<?php comment_text() ?></div>
Those are the lines that print the commenting text on the Comments section of your blog. You then have to insert these Gravatar codes around them, like this:
<!– GRAVATAR CODE –>
<table cellpadding=”0″ cellspacing=”1″>
<?php echo get_avatar( $comment, $size = ’40′ ); ?>
<?php if ( $comment->comment_author_email == get_the_author_email() ) echo ‘authorcomment’; else echo ‘thecomment’ ?>” id=”comment-<?php comment_ID() ?>”>
…………<div class=”comment-body”><?php comment_text() ?></div>
<!– END OF GRAVATAR CODE –>
So basically put the “wrapping” codes around the codes that start with something + “if($comment->comment_author_email == get_the_author_email()…..” and something + “<?php comment_text()….”
The end result will be like:
You can change the avatar size by changing the number 40 in the line
<?php echo get_avatar( $comment, $size = ‘40‘ ); ?> to 60,90,120, etc. Try changing the numbers until you’re satisfied with it.
If you know a bit about HTML, then you can always change the codes above to a format that you like. I’m using table to make it neater and make the avatar size to be quite small.
You can always read the official manual to find out more about what you can do with the feature.
Screenshots: (Do you know that by typing “SquareBracket”gallery*SquareBracket* on your post, all of the uploaded images & media on the post will appear automatically? Another neat feature of WordPress 2.5!)
Latest posts by Michael Aulia (see all)
- Google Glass is available to purchase for the public for a limited period of time - 16 April, 2014
- 7 reasons why you should try WeChat - 16 April, 2014
- Twitter gets real-time notification pop-ups - 15 April, 2014