由于众所周知的原因,Google的链接无法加载。
在比较新的WordPress中,都默认加载和Google的Fonts和jquery。包括前台和后台,因此,会导致WordPress慢的一X。
那么如何解决呢?
很多博友给出了一些解决方案:
1.利用插件
Disable Google Fonts : 这个插件是关闭Google Fonts的,据说效果不是很好。
Remove Open Sans font Link from WP core:也是关闭Google Fonts的。
DW Replace Open Sans : 替换Google Fonts加载地址,详见 http://devework.com/replace-open-sans.html
2.通过 functions.php 添加代码
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;
}
或者
function dw_remove_open_sans() {
wp_deregister_style( 'open-sans' );
wp_register_style( 'open-sans', false );
wp_enqueue_style('open-sans','');
}
add_action( 'init', 'dw_remove_open_sans' );
根据我的测试,以上方法都不太彻底。Typecho这种直接打开模板修改即可,但是WordPress,自从升级到3.x,我就搞不懂了。。
打开/wp-includes/script-loader.php文件
从 148 行开始。或者搜索jquery.js找那片区域。
参考 http://libs.useso.com/ 该换的都换掉。
例如,把所有的 ajax.googleapis.com 换成 ajax.useso.com
然后打开主题目录下的 functions.php 文件,121行
$font_url = add_query_arg( $query_args, "$protocol://fonts.googleapis.com/css" );
替换为
$font_url = add_query_arg( $query_args, "$protocol://fonts.useso.com/css" );
不错,很简洁!!!!
博客不错哦
插件直接干掉~
管理员 顾建伟 : 2014年08月23日05:14:36 地下1层
是