How to link Gravatars to Comment Authors URL
Gravatars are globally recognized avatars that are displayed adjacent to your comment in gravatar-enabled blogs. Sounds cool? Register at their site to get a gravatar.
Your Gravatars by default in K2, will link regardless of comment author, to the gravatar website. Luckily this can easily be changed to add that extra bit of usability to your blog. Here’s how.
Open up comments.php in your favorite text editor and look for this piece of code:
<?php if (function_exists('gravatar')) { ?><a href="http://www.gravatar.com/" title="What is this?"><img src="<?php gravatar("X", 32, ""); ?/>" class="gravatar" alt="Gravatar Icon"/></a>< ?php } ?>
and replace it with this code:
<?php if (function_exists('gravatar')) { ?><a href="< ?php comment_author_url(); ?>" title="< ?php comment_author(); ?>'s website"><img src="<?php gravatar("X", 32, ""); ?/>" class="gravatar" alt="Gravatar Icon" />< ?php } ?>
comment_author_url outputs the commenter’s url and comment_author outputs the commenter’s name
Personally, I don’t think I want to do this. What about you?
Like the tip? Don’t thank me, thank Paul Stamatiou.
Read posts on your favorite topic
Blogging | Make Money Online | WordPress | SEO | Internet
Software | Google | Tutorials | Tweaks | Others
Must be valid. No spam from me, promise. Or read via RSS.

