Theme The Morning After

The Morning After – Gravatars, anyone?

In one of the latest comments, I was asked to write a short tutorial about how I have added (gr)avatars to the comment area of this theme. Here you are:



Open comments.php and insert the following code between div class=“commentcont“ and php comment_text():

<?php if(function_exists('get_avatar')){ ?>
<?php echo get_avatar(get_comment_author_email(),50);?>
<?php } ?>

Save/Update comments.php

Open the style.css now, scroll down to /* Comment area styles and add the following line:

#commentlist li .avatar { float:right; padding: 2px; margin-left: 8px; background: #d2d2d2; }


  1. Thanks Nick, great tutorial.

  2. Thanks for the tip Nick! works like charm :)

  3. You’re welcome Ubiquit! Nice Gravatar!

  4. hey, dows this work with the monsterid plugin for wordpress too?

  5. Hi Marcel!
    I haven’t worked with the monsterID plug-in.. so, I don’t know… but if they act as avatars in WP 2.5, there should be no problem.

  6. Nick, it seems your gravatar code somehow interferes with the localization. Compare how the date and time are shown here ( and on plain localized TMA here ( Any idea how to fix that? There’s no localizable code in your gravatars, so what the heck?

  7. Hi!
    Thats really strange.. What happens when you remove the php if function exists and just use the php function:
    Anyway, my guess is that this is related to your qtranslate plug-in.

  8. Nice!
    Cred to you Nick!

  9. great Nick!!
    smashing template
    great support!
    i will insert your websites in my directory links if u send them to me!!!

  10. Ciao max
    What do you mean by directory links?
    Well, is the link!

  11. Nice work! Thanks for all the tips for this theme. I’m working on a redesign and your tips always help!

  12. thank you very much nick you are truly a time saver.

  13. Nick,
    I just noticed that in IE explorer, once a comment is added to a post, it gets all messed up. You can see an example here:
    Do you know what’s up with that?

  14. Hi Lee!
    Strange problem. My comments.php works fine in FF and IE. And I guess you are using the same code like me…

  15. I think I figured it out. I was missing one > in my comments.php and everything was jacked because of it. The beauty of code.

  16. […] Personalized the comments with Gravatars. […]

  17. Hmm. How do I get my own avatar to show up in my response to a comment someone makes on my site? Seems not to be working for some reason. Thanks, Nick.

  18. hmm.. you use the same account / email address for your gravatar account and your blog?
    If yes, you do something wrong….

  19. I have a related question: Is there a way to use Gravatars for the thumbnails for each recent story on the home page of TMA?

  20. nice! thanks for documenting your work.

  21. Hi Nick,
    I don’t have those sections of code in my comments.php – div class=“commentcont“ and php comment_text():
    Has it changed for TMA 1.4?

  22. Nevermind. I’m an idiot. It already supports Gravatar.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht.