首页 >后端开发 >php教程 >wordpress禁止调用官方Gravatar头像调用ssl头像链接提升加载速度,wordpressgravatar_PHP教程

wordpress禁止调用官方Gravatar头像调用ssl头像链接提升加载速度,wordpressgravatar_PHP教程

WBOY
WBOY原创
2016-07-12 08:57:50799浏览

wordpress禁止调用官方Gravatar头像调用ssl头像链接提升加载速度,wordpressgravatar

在主题中的functions.php文件末尾加上以下代码即可(外观>编辑>functions.php)

<span>1</span> <span>//</span><span>官方Gravatar头像调用ssl头像链接</span>
<span>2</span> <span>function</span> get_ssl_avatar(<span>$avatar</span><span>) {
</span><span>3</span>  <span>$avatar</span> = <span>preg_replace</span>('/.*\/avatar\/(.*)\?s=([\d]+)&.*/','<img  src="https://secure.gravatar.com/avatar/$1?s=$2" class="avatar avatar-$2" height="$2"    style="max-width:90%" alt="wordpress禁止调用官方Gravatar头像调用ssl头像链接提升加载速度,wordpressgravatar_PHP教程" >',<span>$avatar</span><span>);
</span><span>4</span>  <span>return</span> <span>$avatar</span><span>;
</span><span>5</span> }

 

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/1106383.htmlTechArticlewordpress禁止调用官方Gravatar头像调用ssl头像链接提升加载速度,wordpressgravatar 在主题中的functions.php文件末尾加上以下代码即可(外观编辑fu...
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn