Title: Using Gravatar code without the plugin
Last modified: August 19, 2016

---

# Using Gravatar code without the plugin

 *  [multiplier](https://wordpress.org/support/users/multiplier/)
 * (@multiplier)
 * [18 years, 2 months ago](https://wordpress.org/support/topic/using-gravatar-code-without-the-plugin/)
 * [WPDesigner recently made a post](http://www.wpdesigner.com/2008/02/01/wordpress-tips-part-2/)
   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='http://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)

 *  [fede777](https://wordpress.org/support/users/fede777/)
 * (@fede777)
 * [18 years ago](https://wordpress.org/support/topic/using-gravatar-code-without-the-plugin/#post-692800)
 * Like this
 * <?
    $email = $comment->comment_author_email; $default = “[http://www.geekspot.com.ar/wp-content/themes/minyx2Lite/pix/default_gravatar.png&#8221](http://www.geekspot.com.ar/wp-content/themes/minyx2Lite/pix/default_gravatar.png&#8221);;//
   link to your default avatar $size = 32; // size in pixels squared $rating = “
   G”; // [G | PG | R | X] $grav_url = “[http://www.gravatar.com/avatar.php?gravatar_id=](http://www.gravatar.com/avatar.php?gravatar_id=)”.
   md5($email) . “&default=” . urlencode($default) . “&size=” . $size.”&rating=”.
   $rating; ?>

Viewing 1 replies (of 1 total)

The topic ‘Using Gravatar code without the plugin’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [fede777](https://wordpress.org/support/users/fede777/)
 * Last activity: [18 years ago](https://wordpress.org/support/topic/using-gravatar-code-without-the-plugin/#post-692800)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
