Support » Fixing WordPress » Should Gravatars Work “out of the box” in 2.5?

  • I recently upgraded from 2.0.2 to 2.5 and see that there are settings for gravatars on the Setup/Comments page. I have registered a gravatar and tried poosting a comment, but the gravatar does not display. Do I need a plugin for gravatars on 2.5 or should 2.5 support gravatars already?

Viewing 13 replies - 1 through 13 (of 13 total)
  • I have this as well. if I view the comments via the admin dashboard then I can see my gravatar however if I view comments through the blog then I cannot see Gravatars. Anyone have any ideas??

    You need a plugin for gravatars to appear in your comments. I use Dougal’s Easy Gravatars.

    Also, good reading: Using_Gravatars

    I have added the code to the comments.php in the theme I am using and it works fine

    I modified my comments.php but trying to style my theme to get it to render nicely gave me a headache. I went back to the plugin which let me style the gravatar quite easily.

    Thanks lexhair & moshu, I’ll give the plugin a shot, but not for a while, trying to withold adding new plugins until 2.5 seems more stable overall, I don’t want to muddy the waters while trying to resolve some other issues.

    I went back to a modified comments.php. I wrapped the get_avatar function in a unique div class tag and it was much easier to style.

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    Gravatars are in 2.5 by default and how to use them is in the default theme as well, but they will not be enabled in your older custom themes until you do so.

    Here’s what I did to enable them in mine. You can use this as an example, to get an idea of how to do it.

    Basically, I wanted them to show up next to the comments. So I edited my comments.php file. First I found this code in it:
    <cite><?php comment_author_link() ?></cite> Says:
    That prints the “Otto says:” bit in my comment. Just in front of that, I added this:

    <?php if (function_exists('get_avatar')) : ?>
    <a href="">
    <?php echo get_avatar($comment, 40); ?>
    <?php endif; ?>

    Like most themes, my theme used “$comment” as the variable for the individual comment. Look for code like this in the file: foreach( $comments as $comment ) {. The $comments name is set by WordPress, but the individual $comment name is determined by the theme. $comment is the usual case.

    And the “40” is the size I wanted the avatar to be, in my theme. 40 pixels was derived by experimenting with different values until I liked it.

    Also note that I made the avatar link to I did this so that if somebody clicks on the avatars, they will discover how to get their own. So if somebody leaves a comment and sees their avatar is the default, then clicking on it will lead them to a place where they can create an avatar for themselves to see.

    Now, this put the avatar in there, but the text was screwy. My comment didn’t flow around it properly, and didn’t leave enough margin space. But, I discovered that the get_avatar function adds a class of “avatar” to what it produces. So styling it was easy, by adding this to my stylesheet:

    .avatar {
    padding: 3px;
    margin-bottom: 5px;

    The float:left makes text wrap around it properly, and the padding and margin makes the text stand away from it a little bit. Again, experimentation helped to determine how I wanted this to work.

    And that’s it. It’s pretty easy if you know where you want it to be. No need for a plugin, just a minor bit of theme editing.

    I’ve just (well I think I have) sorted out Gravatars on my website

    I installed Easy Gravatars, but I think that it’s built in standard so I’m not currently using a plugin, if anyone cares to leave a comment that has gravatars set up we can find out.

    ok 2.6.3 works, I’ve just tested it myself. So all your gonna wanna do is change the default pic.

    thank you. i tried to add gravatars on my page after i had rewritten it so it should have worked on my site… but it didnt… well bad luck i’ll try another thing…

    Thanks lexhair & moshu, I hope that I will give your plugin a shot in the near future. But can’t possibly do that now cause I already have too much plugin on my site as it is. So your would have to wait a little longer I guess.

    @lexhair & moshu & chiahau thanks guys.
    I’m still using a version prior to 2.5 on my foam board insulation blog. I guess I’ll have to update asap … heh.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Should Gravatars Work “out of the box” in 2.5?’ is closed to new replies.