Get avatar of the logged-in user in WordPress

All you need to do is pass the current users email address into the get_avatar() function.

<?php 

$current_user = wp_get_current_user();

if ( ($current_user instanceof WP_User) ) {
    echo get_avatar( $current_user->user_email, 32 );
}

?>

Here are some links for specifics:

get_avatar();
wp_get_current_user();

A response to your new problem in the comments below:

<?php 

echo '<img src="'. get_the_author_meta( 'user_custom_avatar', $current_user->ID, 32 ) .'" />';

?>

I had one too many semicolons in that there code I gave you before, this ought to work.

EDIT

This will make it 10X easier for you. I dont know why I didnt do it this way to begin with. – I’ll just add it into your example snippet the way you want it.

The Real Answer:

<a href="https://wordpress.stackexchange.com/questions/33121/<?php echo get_author_posts_url($post->post_author); ?>" title="<?php the_author_meta( 'display_name', $post->post_author ); ?>">
<?php if( get_the_author_meta( 'user_custom_avatar', $post->post_author ) != '' ) { ?>
    <img src="<?php the_author_meta( 'user_custom_avatar', $post->post_author ); ?>" alt="" />
    <?php echo $curauth->display_name; ?>
<?php } else { 
    $current_user = wp_get_current_user();
    echo get_avatar( $current_user->user_email, $post->post_author ), '80' ); } ?>
</a>

Sorry about that.