Skip to content

Instantly share code, notes, and snippets.

@Pseric
Last active September 12, 2019 05:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pseric/0e66741e1425bdcfc2ae20a4e775f4f5 to your computer and use it in GitHub Desktop.
Save Pseric/0e66741e1425bdcfc2ae20a4e775f4f5 to your computer and use it in GitHub Desktop.
function crunchify_gravatar_alt( $crunchifyGravatar ) {
if ( have_comments() ) {
$alt = get_comment_author();
}
else {
$alt = get_the_author_meta( 'display_name' );
}
$crunchifyGravatar = str_replace( 'alt=\'\'', 'alt=\'Avatar for ' . $alt . '\' title=\'Gravatar for ' . $alt . '\'', $crunchifyGravatar );
return $crunchifyGravatar;
}
add_filter( 'get_avatar', 'crunchify_gravatar_alt' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment