• Site Name: Site Sketch 101
    Site Url: https://www.sitesketch101.com
    WP Version: 2.8.4

    I currently use gravatars in my comments section which really adds life to the comments. I would like to have a specific image displays as the avatar for trackbacks/pingbacks so that they more closely resemble the rest of the comments. I’ve messed around in comments.php and theme-comments.php but I can’t quite figure out what I need to modify to get this done.

    Any help would be greatly appreciated.

Viewing 1 replies (of 1 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    The get_avatar function returns false for trackbacks and pingbacks. You can use this to detect them and to output a special image.

    How you do this depends on your code in particular, but you do need to be using a callback or some similar method to control the html of your comments.

    Look for the call to get_avatar in your theme. It probably looks like this, or similar:
    echo get_avatar($comment, 96);

    Change that to something like this:

    $avatar=get_avatar($comment, 96);
    if (!$avatar) {
    echo '<img src="your_custom_avatar_whatever.png" />';
    } else {
    echo $avatar;
    }

    That sort of thing.

Viewing 1 replies (of 1 total)
  • The topic ‘How do I add a custom avatar to Trackbacks in the comments section?’ is closed to new replies.