Viewing 15 replies - 1 through 15 (of 18 total)
  • First, download the Gravatar plugin from here

    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

    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

    (@richards1052)

    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?

    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.

    <?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, "https://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.

    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

    (@richards1052)

    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.

    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

    (@richards1052)

    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.

    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.

    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=”https://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.

    davidbabylon: try this:
    <?php gravatar('R', '80', <img src="https://www.davidbabylon.com/images/default_avatar.jpg" alt="Default Avatar" />", "FF0000") ?>

    Use the rating and size you really want.

    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=”https://www.davidbabylon.com/images/default_avatar.jpg&#8221; alt=”Default Avatar” />”, “FF0000”) ?>
    <div class=”commenttext”>

    Take a look again at the example above.

    <img src="<?php gravatar("R", 38, "https://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.

    Thanks Skippy. Worked perfectly!

    Thread Starter richards1052

    (@richards1052)

    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, "https://www.richardsilverstein.com/photos/uncategorized/geesbendgravatar.jpg" ,"000000"); ?>" alt="" />

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘gravatar display code issue’ is closed to new replies.