I would like to use gravatar image as background image for a button. When i use get_avatar
function it returns with height width src parameters.
But i need only gravatar url.
I mean like http://gravatar.com/.../...
Can anyone tell me how?
Thanks
Just generate the URL yourself. It’s just a hash of the user’s email address.
This function requires that you pass the user’s email address in … but you could do anything you need to programatically grab the user’s address.
Look at how it is implemented here:
http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/pluggable.php#L1578
Additionally check out the very simple Gravatar API:
http://en.gravatar.com/site/implement/images/
You can try to hook into the
get_avatar
filter andpreg_match
against the'src'
like so:The
some_globally_accessible_var
would be an instance variable or some static variable, global.