Gravatar头像无法显示的解决方法

Gravatar由于被墙导致wordpress的头像无法显示,其实只需要修改主题下的functions.php文件加入以下代码就可以了。

1
2
3
4
5
6
//调用多说Gravatar头像
function mytheme_get_avatar($avatar) {
    $avatar = str_replace(array("www.gravatar.com","0.gravatar.com","1.gravatar.com","2.gravatar.com"),"gravatar.duoshuo.com",$avatar);
    return $avatar;
}
add_filter( 'get_avatar', 'mytheme_get_avatar', 10, 3 );

隐藏“站长统计”文字链接

默认代码:

<script type=”text/javascript”>var cnzz_protocol = ((“https:” == document.location.protocol) ? ” https://” : ” http://”);document.write(unescape(“%3Cspan id=’cnzz_stat_icon_1255624061’%3E%3C/span%3E%3Cscript src='” + cnzz_protocol + “s95.cnzz.com/stat.php%3Fid%3D1255624061′ type=’text/javascript’%3E%3C/script%3E”));</script>

在document.write(unescape(“%3Cspan与id=’cnzz_stat_icon_之间增加style=’display:none;’

修改后:

<script type=”text/javascript”>var cnzz_protocol = ((“https:” == document.location.protocol) ? ” https://” : ” http://”);document.write(unescape(“%3Cspan style=’display:none;’ id=’cnzz_stat_icon_1255624061’%3E%3C/span%3E%3Cscript src='” + cnzz_protocol + “s95.cnzz.com/stat.php%3Fid%3D1255624061′ type=’text/javascript’%3E%3C/script%3E”));</script> 阅读详细 »