苏醒 苏醒
  • 首页
  • WP主题
  • WP插件
  • WP教程
  • 是日一记
  • 博客
    • 留言
    • 唠叨
    • 友情链接
首页 WordPress 教程 关于WordPress后台加载速度慢的问题

关于WordPress后台加载速度慢的问题

suxing 2015-12-30 11:49:08

有朋友说最近使用苏醒的主题,后台加载速度比较慢 😀 。

在这里说明下:最主要是两个因素造成的,一个是谷歌字体,一个是头像的问题。

使用苏醒主题的用户,只要把以下代码贴到functions_suxingme.php或者add.php即可 😛 。

其他朋友,自行添加到functions.php即可。

😐

[quote]谷歌字体[/quote]

后台加载谷歌字体也没什么卵用,所以直接把他禁止掉即可。

add_filter( 'gettext_with_context', 'disable_open_sans', 888, 4 );
function disable_open_sans( $translations, $text, $context, $domain ) {
if ( 'Open Sans font: on or off' == $context && 'on' == $text ) {
$translations = 'off';
}
return $translations;
}

[quote]解决Gravatar头像不显示的问题[/quote]

以下两个办法,二选一即可。

//官方Gravatar头像调用ssl头像链接
function suxingme_get_avatar($avatar) {
$avatar = preg_replace('/.*\/avatar\/(.*)\?s=([\d]+)&.*/','<img src="https://secure.gravatar.com/avatar/$1?s=$2" class="avatar avatar-$2" height="$2" width="$2">',$avatar);
return $avatar;
}
add_filter('get_avatar', 'suxingme_get_avatar');

//使用Gravatar头像服务的(HTTPS)加密线路
function suxingme_replace_avatar($avatar) {
$avatar = str_replace(array("www.gravatar.com", "0.gravatar.com", "1.gravatar.com", "2.gravatar.com"), "cn.gravatar.com", $avatar);
return $avatar;
}
add_filter( 'get_avatar', 'suxingme_replace_avatar', 10, 3 );
# Gravatar头像# Gravatar头像无法显示# wordpress主题# wordpress教程
1

评论 (0)

返回
    发表评论

猜你喜欢

  • 阿里云虚拟机如何设置wordpress伪静态规则
  • 阿里云 CDN 跨域问题: No 'Access-Control-Allow-Origin' header is present on the requested resource
  • WordPress 小Tips:如何不显示站点顶部工具栏
  • PHP 错误 Parse error: syntax error, unexpected '?' 解决办法
  • WordPress 建立数据库连接时出错
suxing
每天清晨有多少双眼睛睁开,有多少人的意识苏醒过来,便有多少个世界。
197
文章
289
评论
306
获赞
suxing

我用的 WordPress 主题

2021 年单栏 WordPress 主题

  • 首页
  • WP主题
  • WP插件
  • WP教程
  • 是日一记
  • 博客
Copyright © 2012-2023 苏醒. Designed by nicetheme.
  • 首页
  • 主题
  • 教程
  • 博客
  • 唠叨
  • 留言
  • 是日一记