• My blog is not showing avatars of commenters. I think something has changed that necessitates a change to my theme’s comments.php file.

    It has :

    <div class="comments">
        <h3><?php comments_number('No Responses', 'One Response', '% Responses' );?> to “<?php the_title(); ?>”</h3>
        <ol class="commentlist">
        <?php foreach ($comments as $comment) : ?>
            <li class="<?php echo $oddcomment; ?>" id="comment-<?php comment_ID() ?>">
                <?php comment_text() ?>
                <p class="commentmetadata">
                    <?php echo get_avatar( $id_or_email, $size = '32'); ?>
                    <small>
                    <cite><?php comment_author_link() ?></cite> said this on
                    <?php if ($comment->comment_approved == '0') : ?>
                    <em>Your comment is awaiting moderation.</em>
                    <?php endif; ?>
                    <a href="#comment-<?php comment_ID() ?>" title=""><?php comment_date('F jS, Y') ?> at <?php comment_time() ?></a> <?php edit_comment_link('edit','(',')'); ?>
                    </small>
                </p>
            </li>
        <?php /* Changes every other comment to a different class */
            if ('alt' == $oddcomment) $oddcomment = '';
            else $oddcomment = 'alt';
        ?>
        <?php endforeach; /* end for each comment */ ?>
        </ol>
    </div>

    I tried replacing:
    <?php echo get_avatar( $id_or_email, $size = '32'); ?>
    with
    <?php wp_list_comments( array( 'avatar_size' => '50' ) ); ?>

    Gravatars appeared, but I do not know how to integrate this into the original structure …. I can’t just replace that one line (comments repeated ad infinitum).

    Any help in fixing up this PHP would be appreciated!

    https://www.ads-software.com/extend/plugins/comments/

  • The topic ‘Showing Commenter Avatars’ is closed to new replies.