Use Gravatar image as WordPress favicon

Gravatar stands for Globally Recognized Avatar. It is globally recognized because millions of people and websites use them. To know more about Gravatar, you can visit https://en.gravatar.com.

To use Gravatar image as favicon on your WordPress site, add the following code in your theme’s functions.php file..

<?php
// Add the following code in theme's functions.php file to use Gravatar image as favicon (16×16 favicon.ico)
function dcg_gravatar_favicon() {
// Replace email here
$GetEmailHash = md5(strtolower(trim('me@dipakgajjar.com')));
?>
<link rel="shortcut icon" href="<?php echo 'http://www.gravatar.com/avatar/' . $GetEmailHash . '?s=16;'; ?>" type="image/x-icon" />
<?php
}
add_action('wp_head', 'dcg_gravatar_favicon');

view raw
functions.php
hosted with ❤ by GitHub

Leave a Reply


Please note: These tutorials are meant to be helpful, but please note that I can not and will not be able to help with any implementations or modifications.

tl;dr If you do not understand it, hire me to do it.