I\'ve been trying to use get_avatar to display the author\'s gravatar under each post in wordpress template with applied class but I couldn`t find a way to add
If @Ryan answer (marked as solution) does'nt work for you, try to change
add_filter('get_avatar','add_gravatar_class');
function add_gravatar_class($class) {
$class = str_replace("class='avatar", "class='avatar pic-2", $class);
return $class;
}
into
add_filter('get_avatar','add_gravatar_class');
function add_gravatar_class($class) {
$class = str_replace('class="avatar', 'class="avatar pic-2', $class);
return $class;
}
This start's work for me after replace " with '.
Sorry that I didn't write this as a comment to that answer, but I don't have 50 reputation to comment other posts.