本文实现的是在Joe主题中文章头像可能是你的邮箱的头像,但是有时候又可能会获取失败的问题,所以索性就以侧栏头像作为作者头像也挺好,不过还是看自己需求,当然你也可以自己搭建api一次性解决这些问题。具体效果欢迎查看我的站点。

开始

修改public/batten.php文件中的<div class="joe_detail__count-information">下面的内容,将img标签内容全部替换成如下

1
2
3
<img width="35" height="35" class="avatar lazyload" src="<?php _getAvatarLazyload(); ?>"
data-src="<?php $this->options->JAside_Author_Avatar ? $this->options->JAside_Author_Avatar() : _getAvatarByMail($this->authorId ? $this->author->mail : $this->user->mail) ?>"
alt="<?php $this->author(); ?>"/>

这里首先会获取配置的侧栏作者头像,其次再是邮箱头像。