How to use your Gravatar as a favicon on your WordPress blog

First, edit the following function by adding your email adress on line 3, then paste it on your functions.php file.

function GravatarAsFavicon() {
	//We need to establish the hashed value of your email address
	$GetTheHash = md5(strtolower(trim('[email protected]')));
	echo 'http://www.gravatar.com/avatar/' . $GetTheHash . '?s=16';
}

Once done, open the header.php file of your theme and paste this:

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

Thanks to Adam Whitcroft for the cool tip!

Leave a Reply

Your email address will not be published. Required fields are marked *