X

Gravatar as Favicon

If you’ve seen how Tumblr uses the blog author’s Gravatar as the blog favicon and want to replicate that in WordPress, simply paste this into your functions.php file.

And then, in the <head> of your header.php, paste the following:

Code Snippet:

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

If you want to use the same function to grab the apple-touch-icon all you need to do is omit the ‘?s=16’, and add in another link in your <head>:

Code Snippet:

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

Code Snippet:

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

Comments  Leave a Reply

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!