Title: gravatar display code issue
Last modified: August 18, 2016

---

# gravatar display code issue

 *  [richards1052](https://wordpress.org/support/users/richards1052/)
 * (@richards1052)
 * [20 years, 11 months ago](https://wordpress.org/support/topic/gravatar-display-code-issue/)
 * I’ve just registered for a gravtar & can’t figure out how to make it work. Here’s
   my gravatar url:
 * [http://www.gravatar.com/avatar.php?gravatar_id=aa2859f2616c9fb536509ebc0b6c3529&#8243](http://www.gravatar.com/avatar.php?gravatar_id=aa2859f2616c9fb536509ebc0b6c3529&#8243);
 * If I understood the directions, you have to insert this within the comment box:
 * `<img src="<?php gravatar() ?/> alt="" />`
 * So how should the entire code look when placed within the box? I’ve tried a few
   configurations in my own blog comment box & nothing’s worked.

Viewing 15 replies - 1 through 15 (of 18 total)

1 [2](https://wordpress.org/support/topic/gravatar-display-code-issue/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/gravatar-display-code-issue/page/2/?output_format=md)

 *  [Cypher](https://wordpress.org/support/users/cypher/)
 * (@cypher)
 * [20 years, 11 months ago](https://wordpress.org/support/topic/gravatar-display-code-issue/#post-223479)
 * First, download the Gravatar plugin from [here](http://gravatar.com/implement.php#section_2_2)
 * Install it, and activate it.
 * Second, edit your comments.php file and within the comments loop place the code
   you have in your post and you will see the gravatar appear.
 * Regards
 *  [skippy](https://wordpress.org/support/users/skippy/)
 * (@skippy)
 * [20 years, 11 months ago](https://wordpress.org/support/topic/gravatar-display-code-issue/#post-223480)
 * You do not add that code when you’re leaving a comment.
 * Gravatar-enabled sites include that bit of code in their comments template file(`/
   wp-content/themes/<your theme>/comments.php` for WordPress).
 *  Thread Starter [richards1052](https://wordpress.org/support/users/richards1052/)
 * (@richards1052)
 * [20 years, 11 months ago](https://wordpress.org/support/topic/gravatar-display-code-issue/#post-223492)
 * OK, I thought I added it inside the comment loop. But after saving the template
   I saw this error when I clicked on the Comment link in my blog:
 * > Parse error: parse error, unexpected ‘/’ in /home/richard2/public_html/tikun_olam/
   > wp-content/themes/almost-spring/comments.php on line 22
 * So, did I not place it inside the comment loop? I looked for the line that said“
   you can start editing here” & placed it there as the first line. Was that wrong?
 *  [Marc](https://wordpress.org/support/users/marc/)
 * (@marc)
 * [20 years, 11 months ago](https://wordpress.org/support/topic/gravatar-display-code-issue/#post-223519)
 * Here is the code from my comment.php, that is also the same theme so it should
   match yours. You can see the [appearence here](http://cranialcavity.net/fullthrottle/wp/).
 * `<?php comment_date('F j, Y') ?> 
    @ <a href="#comment-<?php comment_ID() ?>"
   title="<?php _e('Permanent link to this comment'); ?>"><?php comment_time() ?
   ></a> <?php edit_comment_link(__("Edit"), ' · ', ''); ?>
 * <div style="clear:both;">
 *  <strong><div class="img-dec"><img src="<?php gravatar("R", 38, "[http://cranialcavity.net/fullthrottle/wp/wp-images/flag-grav.gif&quot](http://cranialcavity.net/fullthrottle/wp/wp-images/flag-grav.gif&quot);,
 * "000000"); ?>" alt="" /></div></strong>
 *  <?php comment_text() ?>
    </li>
 *  Pay attention to the code between “clear both>” and “php comment text” Look 
   for the same code and enter your gravatar code.
 *  [Marc](https://wordpress.org/support/users/marc/)
 * (@marc)
 * [20 years, 11 months ago](https://wordpress.org/support/topic/gravatar-display-code-issue/#post-223530)
 * Addendum to the above.
 * Sorry I don’t think I made that post clear and I can’t edit it.
 * Between the “clear both” and the “php comment_text” is the code I entered to 
   stley that section the way I desired (ie <div class=”img-dec”>).
 * Look for the code in your comments.php above that section and below it, it should
   be the same as yours and insert your Gravatar code. Because that blog is using
   the same theme as yours it shouldn’t be a problem locating that section of code.
 *  Thread Starter [richards1052](https://wordpress.org/support/users/richards1052/)
 * (@richards1052)
 * [20 years, 11 months ago](https://wordpress.org/support/topic/gravatar-display-code-issue/#post-223535)
 * Many thanks, Marc. That really helped & now the gravatar is displaying. I didn’t
   add the strong or div class tags or the R/38/000000 items since I wasn’t sure
   whether they corresponded to something special in yr. blog or whether they’d 
   refer to something universal including mine as well.
 * If you think they’re important I can insert them as well.
 * Thanks again.
 *  [Marc](https://wordpress.org/support/users/marc/)
 * (@marc)
 * [20 years, 11 months ago](https://wordpress.org/support/topic/gravatar-display-code-issue/#post-223545)
 * Check the instruction given with the plugin code. The R/38 tells the plugin to
   restrict images to a “R” rating and the 30 is the px width of the image.
 *  Thread Starter [richards1052](https://wordpress.org/support/users/richards1052/)
 * (@richards1052)
 * [20 years, 11 months ago](https://wordpress.org/support/topic/gravatar-display-code-issue/#post-223567)
 * Good to know. I think the R is a useful parameter & added it to mine…do you think
   it matters much whether you use yr. gravatar image hosted on their site or whether
   you host it on your own? I could do either. If their site is reliable then I 
   suppose it’s OK.
 *  [Marc](https://wordpress.org/support/users/marc/)
 * (@marc)
 * [20 years, 11 months ago](https://wordpress.org/support/topic/gravatar-display-code-issue/#post-223579)
 * You should make a default grav and host it on your own site. It would be called
   up for for people that don’t have one.
 * If you look at my site I linked to earlier you can see my default and how it 
   gets called up.
 *  [davidbabylon](https://wordpress.org/support/users/davidbabylon/)
 * (@davidbabylon)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/gravatar-display-code-issue/#post-223725)
 * Sorry if this is a silly question but I am running into a very similar problem
   as richards1052. I installed the Gravatar plugin and activated it. I then placed
   this gravatar code into the comments section;
 * <div class=”commentinfo”>
    <span class=”commentdate”> <?php comment_date() ?>
   | <” title=”comment link url”> <?php comment_time() ?>  <?php edit_comment_link(
   __(“Edit This”), ‘ |’); ?> </span> </div> <div class=”clearer”> </div>
 * **<?php gravatar({rating(), size(), <img src=”[http://www.davidbabylon.com/images/default_avatar.jpg&#8221](http://www.davidbabylon.com/images/default_avatar.jpg&#8221);
   alt=”Default Avatar” />”, “FF0000”}}}}) ?>**
 *  <div class=”commenttext”>
 * After doing this in the comments of all my posts this error came up;
 * **Parse error: parse error, unexpected ‘{‘, expecting ‘)’ in /home/.vamp/davidbabylon/
   davidbabylon.com/wp-content/themes/rin/comments.php on line 35**
 * I apologize if this has already been explained in this thread and I simply did
   not understand but I would appreciate any help anyone might be able to offer 
   me. I am new to php and have found this forum to be a great source of information
   and all the members very helpful.
 * Thanks again.
 *  [skippy](https://wordpress.org/support/users/skippy/)
 * (@skippy)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/gravatar-display-code-issue/#post-223726)
 * davidbabylon: try this:
    `<?php gravatar('R', '80', <img src="http://www.davidbabylon.
   com/images/default_avatar.jpg" alt="Default Avatar" />", "FF0000") ?>`
 * Use the rating and size you really want.
 *  [davidbabylon](https://wordpress.org/support/users/davidbabylon/)
 * (@davidbabylon)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/gravatar-display-code-issue/#post-223727)
 * Skippy, thanks for the quick response.
    I entered in the code you suggested and
   recieved the same error. Am I not placing the code in the right spot? Here is
   where I placed it in the comments.php file;
 * <?php edit_comment_link(__(“Edit This”), ‘ |’); ?>
    </span> </div> <div class
   =”clearer”> </div> **<?php gravatar(‘R’, ’80’, <img src=”[http://www.davidbabylon.com/images/default_avatar.jpg&#8221](http://www.davidbabylon.com/images/default_avatar.jpg&#8221);
   alt=”Default Avatar” />”, “FF0000”) ?>** <div class=”commenttext”>
 *  [skippy](https://wordpress.org/support/users/skippy/)
 * (@skippy)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/gravatar-display-code-issue/#post-223729)
 * Take a look again at the [example](http://wordpress.org/support/topic/37159#post-209937)
   above.
 * `<img src="<?php gravatar("R", 38, "http://cranialcavity.net/fullthrottle/wp/
   wp-images/flag-grav.gif", "000000"); ?>" alt="" />`
 * You’re placing the `<?php gravatar ...?>` bit where you would normally place 
   a URL to an image.
 *  [davidbabylon](https://wordpress.org/support/users/davidbabylon/)
 * (@davidbabylon)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/gravatar-display-code-issue/#post-223730)
 * Thanks Skippy. Worked perfectly!
 *  Thread Starter [richards1052](https://wordpress.org/support/users/richards1052/)
 * (@richards1052)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/gravatar-display-code-issue/#post-223751)
 * I recently tried to follow Marc’s advice by uploading my own gravatar image hosted
   on my WP site. Whereas before when I used the gravatar.com image in my php code,
   the gravatar displayed correctly. Using the image url hosted on my own site somehow
   caused every single comment on my site to display my gravatar. There’s prob. 
   a coding issue here. Can someone help me out by pointing out my mistake?
 * `<img src="<?php gravatar("R",80, "http://www.richardsilverstein.com/photos/uncategorized/
   geesbendgravatar.jpg" ,"000000"); ?>" alt="" />`

Viewing 15 replies - 1 through 15 (of 18 total)

1 [2](https://wordpress.org/support/topic/gravatar-display-code-issue/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/gravatar-display-code-issue/page/2/?output_format=md)

The topic ‘gravatar display code issue’ is closed to new replies.

## Tags

 * [img](https://wordpress.org/support/topic-tag/img/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * 18 replies
 * 5 participants
 * Last reply from: [richards1052](https://wordpress.org/support/users/richards1052/)
 * Last activity: [20 years, 10 months ago](https://wordpress.org/support/topic/gravatar-display-code-issue/page/2/#post-223760)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
