For some reason get_avatar($user_email, 125);
doesn’t work. I can’t figure out why. This is my code in single.php
:
<?php
$curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author));
$user_email = $curauth->user_email;
?>
<div class="author-box clearfix">
<img class="author" src="<?php echo get_avatar($user_email, 125); ?> " width="125" height="125" alt="<?php echo the_author_meta( 'display_name' , $author_id ); ?>" />
<h4 class="title"><?php echo get_the_author(); ?></h4>
<p class="title"><?php the_author_meta( 'title' ); ?></p>
<p class="info"><strong>M: </strong><?php the_author_meta( 'user_email' ); ?></p>
<p class="info"><strong>W: </strong><a href="<?php the_author_meta( 'user_url' ); ?>"><?php the_author_meta( 'user_url' ); ?></a></p>
</div>
From the get_avatar documentation, it returns the entire image element string.
The way you’re using it, you’d want the image url, so use get_avatar_url.
learn to create your own author box here