How to Use Your Gravatar As the Favicon For Your WordPress Site

It doesn’t matter what kind of site you have, you absolutely need a favicon. It identifies your site within the the browser’s address bar and tabs, as well as serving as the icon when someone bookmarks your site. You really don’t want to leave this as the default icon, because you’ll miss out on a chance to brand for your site.

Want to save yourself the trouble of creating a favicon for your website? Why not use a tiny version of your Gravatar instead? Check it out:

Using your Gravatar as the favicon of your site is easier than you might think. You can do this in two quick steps.

This code snippet comes to you courtesy of our friends at wp-snippets.com, a fantastic site packed full of quality WordPress hacks.

Step 1: Add the function to your functions.php file.

1
2
3
4
5
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';
}

Make sure to replace the email address in the code with your own email address. It must be the email associated with your Gravatar account.

Step 2: Add the link to your header.php file.

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

Click save and refresh your site to see your new Gravatar favicon in place.

Using your Gravatar can be very handy if you want to have a favicon for your blog, but you haven’t made a logo for yourself. It’s also much easier than creating a .ico file yourself and uploading it to the correct folders on your site.

Don’t leave your site with the boring default icon for its favicon! Add these quick code snippets and you can have your very own custom favicon in under a minute.

Featured Plugin - WordPress Facebook Plugin

Would you like to add Facebook comments, registration, 'Like' buttons and autoposting to your WP site? Well, The Ultimate Facebook plugin has got that all covered!
Find out more

Featured Plugin - WordPress Ecommerce Shopping Cart Plugin

Out of all the WordPress ecommerce plugins available, MarketPress has got to be the winner - easy to configure, powerful functionality, multiple gateways and more. A simply brilliant plugin!
Find out more

Featured Plugin - WordPress Appointments Plugin

Take, set and manage appointments and client bookings without having to leave WordPress. Appointments+ makes it easy.
Find out more

Featured Plugin - WordPress Q&A Site Plugin

It's now incredibly easy to start your own Q&A site using nothing more than WordPress - The Q&A plugin simply and brilliantly transforms any site, or page, into a perfect support or Q&A environment.
Find out more

Featured Plugin - WordPress Wiki Plugin

To get a wiki up and running you used to need to install Mediawiki and toil away for days configuring it... not any more! This plugin gives you *all* the functionality you want from a wiki, in WordPress!!!
Find out more

Featured Plugin - WordPress Google Maps Plugin

Simply insert google maps into posts, sidebars and pages - show directions, streetview, provide image overlays and do it all from a simple button and comprehensive widget.
Find out more

Featured Plugin - WordPress Membership Site Plugin

If you're thinking about starting a paid, or just private, membership site then this is truly the plugin you've been looking for. Easy to use, massively configurable and ready to go out of the box!
Find out more

Featured Plugin - WordPress Infinite SEO Plugin

Fully integrated with the SEOMoz API, complete with automatic links, sitemaps and SEO optimization of your WordPress setup - this is the only plugin you need to help you rank your site number 1 on Google - nothing else compares.
Find out more

Featured Plugin - WordPress Newsletter Plugin

Now there's no need to pay for a third party service to sign up, manage and send beautiful email newsletters to your subscriber base - this plugin has got the lot.
Find out more

Comments (4)

Participate