PHP code snippet – How to add if condition for avatar image?
<?php $authorpic = get_the_author_meta('author_pic'); if ($authorpic) echo $authorpic; else echo get_avatar( get_the_author_email(), '80' ); ?> or <?php $avatar_url = get_avatar_url( $ID, array( 'size'=>200, 'default'=>'404' ) ); if( getimagesize( $avatar_url ) > 1 ) { echo '<img src="'. $avatar_url .'" alt="" class="avatar avatar-200">'; } ?>