Author Avatar Picture In WordPress 3.9.X

My aunt asked me to show her picture on her WP blog for author instead of these self generated avatar. After searching on the internet, here is how I did it for her.

The code needed in the functions.php of the theme.

The code needed in the loop (main) and loop-single (post).

<?php echo get_avatar( get_the_author_email(), ’60’ ); ?> 60 is the size of the image in pixels.

loop

<span class=”comments-link”><?php comments_popup_link( __( ‘Leave a comment’, ‘twentyten’ ), __( ‘1 Comment’, ‘twentyten’ ), __( ‘% Comments’, ‘twentyten’ ) ); ?></span>
<?php edit_post_link( __( ‘Edit’, ‘twentyten’ ), ‘<span class=”meta-sep”>|</span> <span class=”edit-link”>’, ‘</span>’ ); ?>
<?php echo get_avatar( get_the_author_email(), ’60’ ); ?>

loop avatar display

loop-single

<div class=”entry-meta”>
<?php twentyten_posted_on(); ?>&nbsp;-&nbsp;<?php twentyten_posted_in(); ?>&nbsp;<?php the_views(); ?>&nbsp;<small><span class=”st_sharethis_hcount”></span></small><div class=”fb-like” data-href=”http://www.tambl.net” data-send=”false” data-layout=”button_count” data-width=”450″ data-show-faces=”true” data-font=”lucida grande” data-colorscheme=”dark”></div>
<?php echo get_avatar( get_the_author_email(), ’60’ ); ?>

loop_single avatar display

We do need avatar picture loaded, I use Author Image plug-in, it’s easy to use.

author_image plugin

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.