I need a code implemented within function.php so I can get post author gravatar url as template tag get_author_gravatar_url()
.
So far I am using template tag my_gravatar_url()
using function:
function my_gravatar_url() { // Get user email
$user_email = get_the_author_meta( 'user_email' );
/* Convert email into md5 hash and set image size to 65 px */
$user_gravatar_url = 'http://www.gravatar.com/avatar/' . md5($user_email) . '?s=150';
echo $user_gravatar_url; }
You just need to modify the function slightly to
return
the value (rather than displaying it):