How do I add the author's image to a listing (by default)?

  • Jesse
    Jesse
    Newbie 90 points
    August 7, 2013 at 7:30 pm

    Hi, does anyone know if it’s possible to add the author’s image (or link to their profile page) to every listing by default?

    I see under My Account > My Profile Page it says “My Profile Link: Share your profile link with your friends and family online so they can see your website profile” (which implies this is done manually)?

    Thanks!

  • Aaron
    Aaron
    Super Guru 920 points
    August 7, 2013 at 11:46 pm

    Are you wanting to display the Gravatar image or something else?

  • Mark Fail
    Mark Fail
    Super Guru 13,013 points
    August 8, 2013 at 2:43 am

    this can be done but would need manual editing, its not default.

  • Jesse
    Jesse
    Newbie 90 points
    August 8, 2013 at 5:28 am

    Hi Aaron, yes exactly (a gravatar). Have you had any luck (with manual editing)? And Mark, is there any way to add some text as an admin that the author cannot remove? Thanks

  • Aaron
    Aaron
    Super Guru 920 points
    August 8, 2013 at 5:41 am

    You can echo it like this:

    <?php echo get_avatar( get_the_author_meta( ‘ID’ ), 32 ); ?>

    https://codex.wordpress.org/Function_Reference/get_avatar

  • Mark Fail
    Mark Fail
    Super Guru 13,013 points
    August 8, 2013 at 5:50 am

    🙂

  • Jesse
    Jesse
    Newbie 90 points
    August 8, 2013 at 6:22 am

    Aaron, thank you so much! Sorry I neglected to say I’m a newbie, but after checking out that WP article I found the source file it referenced:

    get_avatar() is located in wp-includes/pluggable.php

    …and on line 1587 where it says: if ( !function_exists( 'get_avatar' ) ) :

    …but after this I’m over my head(!) May I ask what to do with this line you suggested?

    <?php echo get_avatar( get_the_author_meta( ‘ID’ ), 32 ); ?>

    Thanks 😉

Viewing 7 posts - 1 through 7 (of 7 total)

New Business Themes for WordPress 2020

Start your new website today!

View Business Themes