• WPDesigner recently made a post on adding gravatars to comments without the plugin. The code looks like this:

    <?php if(!empty($comment -> comment_author_email)) {
    $md5 = md5($comment -> comment_author_email);
    $default = urlencode('PATH to default image');
    echo "<img src='https://www.gravatar.com/avatar.php?gravatar_id=$md5&size=20&default=$default' alt='' />";
    }
    ?>

    My question is: how to I construct the path to the default image (images/nopic.gif)? Here is the code I tried, which failed:

    $default = urlencode(' . get_bloginfo('template_url') . /images/nopic.gif');

    Thanks!

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Using Gravatar code without the plugin’ is closed to new replies.