Display Avatars For Logged In Users to Encourage Commenting

Paste this snippet anywhere in your theme’s template files to display the avatar of a logged-in user. I think it works well to put just above the comment form in your single.php file so that the user sees his photo above the comment form, encouraging him to have something to say. Check out the screenshot below of this snippet in action.

Here’s the code:

1
2
3
4
5
6
7
<?php
    global $current_user;
    
        get_currentuserinfo();
        
        echo get_avatar( $current_user->ID, 128 );
 ?>

Source: aext.net