Paulund
2011-12-14 #html5

How To Use Your Gravatar as Favicon

What is Favicon

A favicon (short for ‘favorites icon’), are little icons associated with a particular website shown next to the site’s name in the URL bar of most browsers. This will also appear in the tabs of the browser which makes your website easy to notice.

Gravatar

A Gravatar is your image that follows you from to different sites and will appear as your image next to your name. So if you make a comment on a blog they will be able to use your Gravatar to display your personalised image. Gravatars helps people become familiar with your image. Your Gravatar is linked to your email address so if you use the same email addresses on different blogs you will have the same Gravatar. On Tumblr blogs they will use your Gravatar as your favicon so you can do the same thing on a Wordpress blog by using the following snippet. Just copy and paste the following in your functions.php file.


function GravatarAsFavicon() {
	$hashedEmail = md5(strtolower(trim('[email protected]')));
	echo 'http://www.gravatar.com/avatar/' . $hashedEmail . '?s=16';
}

Now in your header.php file you need to add the following inside the head tag.


<link rel="shortcut icon" href="<?php GravatarAsFavicon(); ?>" />