[resolved] Gravatar avatars in posts (3 posts)

  1. levani01
    Posted 7 years ago #

    Is it possible to automaticaly add author's Gravatar avatar next to every post title? I have found several plugins but they all work for comments only. I need to add avatars in comments as well as in posts. Can you help me?

  2. kwbridge
    Posted 7 years ago #

    I'm not aware of a plugin that does this (although there could very well be one) but this tutorial explains how to add it to the end of each post.


  3. maxy
    Posted 6 years ago #

    Hi there,

    I have the following code in my single.php

    Its supposed to pull the Gravatar for the relevant author who has written the post and display their name as well within each single post. Similar code is within my comments.php and this works fine.

    I can't understand what I am missing - I'm no expert!

    Thanks in advance -



    <?php if (get_option('woo_author') != "") { ?>

    <div class="author_info">
    <h3>This post was written by:</h3>

    // Determine which gravatar to use for the user
    $email = get_the_author_email();
    $grav_url = "http://www.gravatar.com/avatar.php?gravatar_id=".md5($email). "&default=".urlencode($GLOBALS['defaultgravatar'] )."&size=48";
    $usegravatar = get_option('woo_gravatar');

    <?php if ( $usegravatar ) { ?><span class="author_photo"><img src="<?php echo $grav_url; ?>" width="48" height="48" alt="" /></span><?php } ?>
    <p><?php the_author_posts_link(); ?> - who has written <?php the_author_posts(); ?> posts on /"><?php bloginfo('name'); ?>.</p>
    <p><?php the_author_description(); ?> <br style="clear:both;" /></p>
    <p class="author_email">">Contact the author</p>

    <?php } ?>

Topic Closed

This topic has been closed to new replies.

About this Topic