Gravatars and threaded comments
-
Hello –
I’m trying to figure out how to use gravatars on my site. I know I’m supposed to put this line: <img src=”<?php gravatar() ?>” alt=”” /> somewhere, but where? I’m using Brian’s threaded comments, so I have a comments.php file in my theme. Anybody know where it goes within that file? Do I need to put it in more than once?
Thanks!
-
the same here. i really don´t know how this could work….we have the same prob…hope someone can help us soon. gravatar is needed 🙂 !!
You place the
<img src="<?php gravatar() ?>" ... >somewhere inside the comment loop.This example might help. The example is just that — an example — and probably won’t work if you simply copy and paste.
<i>somewhere inside<i>
Heh. That’s the problem. There is so much going on in the comments.php file for threaded comments that I cannot figure out what it takes. The if’s and else’s are more than my brain can figure out! 🙂
Does the example use threaded comments, too? Thanks for posting it!
No, my example does not use threaded comments.
The list of comments is displayed by use of a “foreach” loop, which starts with this line:
<?php foreach ($comments as $comment) :
Then, inside each iteration of this loop, each comment’s data is displayed. You’ll want to place your gravatar image declaration somewhere inside this foreach loop, which ends with this line:
<?php endforeach; ?>I cannot find that loop within the comments file. I even did a “find” on it.
line 31 of Brian’s Threaded Comments declares a function called “write_comment()”, which is used to display one comment. This function is called repeatedly, as long as there are comments.
You will want to insert your gravatar image declaration in there, somewhere.
I figured it out:
I put this
<img src=”<?php gravatar(“”, 20) ?>” alt=”” />below this line:
<img class=”collapseicon” src=”<?=get_settings(“siteurl”)?>/wp-content/plugins/briansthreadedcomments.php?openedthreadimage=true” onclick=’collapseThread(“div-comment-<?php comment_ID() ?>”)’ />above this line:
<?php comment_author_link() ?></cite> Says:You can see it here:
http://www.stealtheblinds.net/2005/05/15/step-right-up/#commentsSkippy – Thanks so much!
I hope this helps someone else!YES IT DID!!!! thx. that was an easy tut for a dump!!! like you, erm yuh.. 🙂
fine fine now everything´s clear. thx
So how do you do this with normal comments in 1.5.1.2? I’m having trouble where to put the lin
<?php gravatar(“R”); ?>
Cheers
Sproke :0)Can we call this thread resolved now? Or do you still need assistance?
Hey–
I am using the threaded comments plugin and Skippy’s gravatar plugin
and I have everything working except when using the theaded comment template, local avatars are seemingly ignored and only the blank avatar is shown.
I am using this code to invoke it:
<div id="div-comment-<?php comment_ID() ?>" class='comment <?php echo $oddcomment?>'>
<a name='comment-<?php comment_ID() ?>' id='comment-<?php comment_ID() ?>'></a>
<cite><?php if (function_exists('gravatar')) {
if ('' != get_comment_author_url()) { ?><a href="<?php comment_author_url(); ?>" title="Visit <?php comment_author() ?>">
<?php } else { ?><a href="http://www.gravatar.com"> <?php } ?><img src="<?php gravatar($comment->comment_author_email); ?>" alt="Get your own gravatar for comments by visiting gravatar.com" class="gravatar" />
</a>
<?php } ?>
<?php comment_author_link() ?></cite> Says:
<?php if ($comment->comment_approved == '0') : ?>
<em>Your comment is awaiting moderation.</em>
<?php endif; ?>Any ideas? If I use the standard template the local avatar shows up..
bump
OK– after getting some sleep I have seemingly figured out what was wrong:
<?php if (function_exists('gravatar')) {
if ('' != get_comment_author_url()) { ?><a href="<?php comment_author_url(); ?>" title="Visit <?php comment_author() ?>">
<?php } else { ?><a href="http://www.gravatar.com"> <?php } ?><img src="<?php gravatar(get_comment_author_email()); ?>" alt="Get your own gravatar for comments by visiting gravatar.com" class="gravatar" />
</a>
<?php } ?>This appears to be working
The topic ‘Gravatars and threaded comments’ is closed to new replies.