A little theme function help (get_avatar)
-
Okay I’m by no means a coder and this will probably be pretty funny to somebody but here is what I’m trying to do. I’m adding the new get_gravatar function to my themes and this is the code that I’m using.
function techozoic_gravatar() { if (function_exists('get_avatar')) : ?> <div class="avatar_cont"> <?php if (! empty($comment->comment_author_url) ){ // Did they leave a link ?> <a rel="external nofollow" href="<?php comment_author_url(); ?>" title="<?php comment_author(); ?>"> <?php echo get_avatar( get_comment_author_email(), '50' ); ?></a> <?php } else { ?> <?php echo get_avatar( get_comment_author_email(), '50' ); }?> </div> <?php endif; } ?>
I’ve put this in my functions.php and calling it in my comment loop with
<?php techozoic_gravatar(); ?>
. The thing is it seems that in the functions.php file the$comment->comment_author_url
doesn’t work, but if I put the code directly into my comment loop it works just fine. Thanks
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘A little theme function help (get_avatar)’ is closed to new replies.