• redge

    (@redge)


    Hi!

    I want to use gravatar in my template. I know I have to put this code : <img src=”<?php gravatar() ?>” alt=”” /></img>

    in the comment template. But god, where? I’m not using the default them nor the classic one. So the code insn’t the same.

    Whats all the step to implement gravatar in you blog? I’ve already look at https://www.gravatar.com/implement.php?PHPSESSID=7fb4b0fdc25a1f9cc9261052f48ca8be#section_2_2 and it was no help at all, beleave me!

    Also, do I have to put something in the CSS template?

    This is not simple at all!

Viewing 15 replies - 1 through 15 (of 26 total)
  • tjinh200

    (@tjinh200)

    i’m not entirely certain, as i haven’t looked into this further, but i would suggest taking note of the PHP instructions on the link you provided (they are a bit down on that page)…

    davincim

    (@davincim)

    Redge,

    Go to your comments.php file and find the following:


    <ol class="commentlist">

    <?php foreach ($comments as $comment) { ?>

    <li class="<?=$oddcomment;?>"

    I put the line of code you’re referring to just beneath this and it worked like a charm.

    Thread Starter redge

    (@redge)

    Davincim,

    I do have the <li class=”<?=$oddcomment;?>” line but not the <ol class=”commentlist”> and <li class=”<?=$oddcomment;?>”

    So here my complete code of comments.php :

    <div id=”comments”>

    <?php if ( !empty($post->post_password) && $_COOKIE[‘wp-postpass_’ . COOKIEHASH] != $post->post_password) : ?>
    <?php _e(‘Enter your password to view comments.’); ?>
    <?php return; endif; ?>

    <dl id=”comments-block”>
    <?php if ( comments_open() ) : ?>
    <dd style=”margin: 0px; padding: 0px;”>
    <p style=”margin: 0px; margin-bottom: 1em; padding: 0px;”><b><?php comments_number(__(‘No Comments’), __(‘1 Comment’), __(‘% Comments’)); ?> so far</b>
    <?php else : // If there are no comments yet ?>
    <?php endif; ?>
    <?php if ( comments_open() ) : ?>

    “>Leave a comment
    <?php endif; ?>

    <?php if ( $comments ) : ?>

    <?php $myvar=0; ?>
    <?php foreach ($comments as $comment) : ?>
    <?php $myvar++; ?>
    <?php if ($myvar == 1) {$swap = “background-color: #eeeee6; padding: 5px;”;} ?>
    “>
    <div class=”commentBox” style=”<?php echo $swap; ?>”>

    <?php comment_text() ?>

    <p class=”post-footer” style=”margin-bottom: 0px; padding-bottom: 0px;”>By <?php comment_author_link() ?> on <?php comment_date(‘m.d.y’) ?> <?php comment_time() ?> <?php edit_comment_link(__(“e”), ”); ?>
    </div>

    <?php if ($myvar == 1) {$myvar = -1; $swap = “background-color: #e5e5e5; padding: 5px;”;} ?>
    <?php endforeach; ?>

    <?php else : // If there are no comments yet ?>

    <?php endif; ?>
    </dd>
    </dl>

    <div class=”right”><?php comments_rss_link(__(‘RSS feed for comments on this post.’)); ?>
    <?php if ( pings_open() ) : ?>
    ” rel=”trackback”><?php _e(‘TrackBack URI’); ?>
    <?php endif; ?>
    </div>


    <?php if ( comments_open() ) : ?>
    <b><?php _e(‘Leave a comment’); ?></b>
    <?php _e(“Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed:”); ?> <?php echo allowed_tags(); ?>

    <form action=”<?php echo get_settings(‘siteurl’); ?>/wp-comments-post.php” method=”post” id=”commentform”>

    <input type=”text” name=”author” id=”author” class=”textarea” value=”<?php echo $comment_author; ?>” size=”15″ tabindex=”1″ />
    <label for=”author”><?php _e(‘Name’); ?></label> <?php if ($req) _e(‘(required)’); ?>
    <input type=”hidden” name=”comment_post_ID” value=”<?php echo $post->ID; ?>” />
    <input type=”hidden” name=”redirect_to” value=”<?php echo htmlspecialchars($_SERVER[‘REQUEST_URI’]); ?>” />

    <input type=”text” name=”email” id=”email” value=”<?php echo $comment_author_email; ?>” size=”15″ tabindex=”2″ />
    <label for=”email”><?php _e(‘E-mail’); ?></label> <?php if ($req) _e(‘(required)’); ?>

    <input type=”text” name=”url” id=”url” value=”<?php echo $comment_author_url; ?>” size=”15″ tabindex=”3″ />
    <label for=”url”><?php _e(‘URI’); ?></label>

    <label for=”comment”><?php _e(‘Your Comment’); ?></label>

    <textarea name=”comment” style=”border: 1px solid #000;” id=”comment” cols=”40″ rows=”6″ tabindex=”4″></textarea>

    <input name=”submit” id=”submit” type=”submit” tabindex=”5″ value=”<?php _e(‘Say It!’); ?>” />

    <?php do_action(‘comment_form’, $post->ID); ?>
    </form>

    <?php else : // Comments are closed ?>

    <?php endif; ?>
    </div>

    <!– Begin #comments –>
    <!– ItemPage>
    <div id=”comments”>

    <BlogItemCommentsEnabled>
    <h4><$BlogItemCommentCount$> Comments:</h4>
    <dl id=”comments-block”>
    <BlogItemComments>
    <dt class=”comment-poster” id=”c<$BlogCommentNumber$>”>“>
    <$BlogCommentAuthor$> said…
    </dt>
    <dd class=”comment-body”>

    <$BlogCommentBody$>
    </dd>
    <dd class=”comment-timestamp”>” title=”comment permalink”><$BlogCommentDateTime$>
    <$BlogCommentDeleteIcon$>
    </dd>
    </BlogItemComments>
    </dl>
    <p class=”comment-timestamp”>

    <$BlogItemCreate$>

    </BlogItemCommentsEnabled>
    <p class=”comment-timestamp”>
    “><< Home

    </div>

    </ItemPage –>

    <!– End #comments –>

    Thread Starter redge

    (@redge)

    Any ideas?

    tjinh200

    (@tjinh200)

    have you tried putting it beneath the <li class="<?=$oddcomment;?>" line?

    Thread Starter redge

    (@redge)

    No because there is no <li class=”<?=$oddcomment;?> in my comments.php

    I’m using the MinimaPlus Theme

    iand

    (@iand)

    Try near <$BlogCommentAuthor$> which is where the name of the commenter is displayed.

    Thread Starter redge

    (@redge)

    Ok Ive put it like this : <$BlogCommentAuthor$><img src=”<?php gravatar() ?>” alt=”” /></img> said…

    But it’s not working…

    Thread Starter redge

    (@redge)

    It’s not working. Do I have to put something between theses tags? I mean, wheres the ><

    <img src=”<?php gravatar() ?>” alt=”” /></img>

    iand

    (@iand)

    I don’t think the </img> is necessary. Have you got the plugin installed and activated properly?

    Thread Starter redge

    (@redge)

    Yes i did

    Thread Starter redge

    (@redge)

    And I’ve put this code <img src=”<?php gravatar() ?>” alt=”” /> right after <$BlogCommentAuthor$> and gravatar don’t show up!

    holographic

    (@holographic)

    mine is just before the <?php comment_text() ?>, if that’s any use to you

    by the way, all that <$BlogCommentAuthor$> stuff at the bottom of the code you posted- what does that do? Looks like MT tags to me, but I could be wrong

    iand

    (@iand)

    My last suggestion for now (its 1am) – View the source on your comments page – see if anything shows up – that will tell you if the plugin is working. Also I suggest putting the call as <?php gravatar("R", 40, "https://path to no gravatar image.jpg", "FF0000"); ?> That way something should appear.
    The URI of your site might help too.

    Thread Starter redge

    (@redge)

    Ok I’ll try this and IanD, my URI is https://pfinal.com

Viewing 15 replies - 1 through 15 (of 26 total)
  • The topic ‘How to use Gravatar?!’ is closed to new replies.