我这个主题默认是不显示gravatar头像的,于是我在网上搜了些代码,并在七两同学的热心帮助下,我的评论框可以正常显示头像了。

操作步骤:

先去下载gravatar插件,上传到plugins目录并在WP后台激活。

把下面的代码复制到相应主题的style.css文件中

.gravatar img {
float:left;
margin-top:5px;
margin-left:5px;
}

然后把下面代码复制到comments.php的相应位置

<div class=”gravatar”>

<?php echo get_avatar( $comment, 30 ); ?>

</div>

如果你想和我的样式一样,你可以把代码复制到

<li <?php echo $oddcomment; ?>id="comment-<?php comment_ID() ?>"><cite><?php comment_author_link() ?></cite>之间