Elegant Themes: The Best Theme Club Ever!

You Are Here: Home » How-To & Hacks » Quick Tut: Display Gravatar Image As Your WordPress Site’s Favicon

Quick Tut: Display Gravatar Image As Your WordPress Site’s Favicon

Branding is definitely one of crucial factors for a site’s success. You to have keep pushing your logo and site icon to your readers/visitors to strengthen your brand. Without doing this, whenever people see your logo and site icon, those images are simply another image that your readers see in the internet.

Napoleon Hill once said;

Any idea, plan, or purpose may be placed in the mind through repetition of thought.

One of the ways that you can take to enhance your branding is by displaying Gravatar image as your WordPress site’s favicon.

In case you have no idea what favicon and Gravatar are all about, check out below screenshot;

Quick Tut: Display Gravatar Image As Your WordPress Site's Favicon

The easiest way to display the Gravatar image as your WordPress site’s favicon is by pasting below code snippet into your WordPress theme‘s functions.php file.

function gravatar_favicon() {
 $GetTheHash = md5(strtolower(trim(get_bloginfo('admin_email'))));
 return 'http://www.gravatar.com/avatar/' . $GetTheHash . '?s=16';
}
function favicon() {
 echo '<link rel="Shortcut Icon" type="image/x-icon" href="'.gravatar_favicon().'" />';
}
add_action('wp_head', 'favicon');

Then, head right away to your settings menu to update the default admin_email.

With these 2 steps, you can now have same image for both, Gravatar and favicon of your WordPress site. It is not hard to bring your brand a step further right?

Enjoy!

Credit: WP Snipp

Leave a Comment

© 2011 Powered By Wordpress. Kissing Crust | Getting More Out Of WordPress.

Scroll to top