Instantly share code, notes, and snippets.

Embed
What would you like to do?
Blog Avatar
<?php
/*
Plugin Name: Blavatars
Plugin URI: https://gist.github.com/1724438
Description: Use Gravatar as a blogs avatar (Web Clip, Favicon, ...)
Version: 0.1
Author: Matthias Pfefferle
Author URI: http://notizblog.org/
*/
add_action('wp_head', 'blavatar_header');
function blavatar_header() {
?>
<link rel="apple-touch-icon" href="<?php get_blavatar(57); ?>" />
<link rel="apple-touch-icon" sizes="72x72" href="<?php get_blavatar(72); ?>" />
<link rel="apple-touch-icon" sizes="114x114" href="<?php get_blavatar(114); ?>" />
<link rel="icon favicon shortcut" sizes="16x16" href="<?php get_blavatar(16); ?>" />
<?php
}
function get_blavatar($size = 90) {
echo get_the_blavatar($size);
}
function get_the_blavatar($size = 90) {
return "http://www.gravatar.com/avatar/" .
md5(strtolower(get_bloginfo("admin_email"))) . "?s=" . $size;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment