下面所述基于:WordPress 4.1版本
主体思路是:
将 fonts.googleapis.com
替换为 fonts.useso.com (
360网站缓存的Google 字体)
具体方法如下:
好多网上的做法只是替换wp-includes/script-loader.php
文件中的fonts.googleapis.com 。这样是不全的。为啥?你搜一下就知道了。在WordPress根目录下搜索使用的地方:
[forlong401 wordpress]# grep -r “fonts.googleapis.com” .
./wp-includes/script-loader.php: // $open_sans_font_url = “//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,300,400,600&subset=$subsets”;
./wp-includes/js/tinymce/plugins/compat3x/css/dialog.css:@import url(//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,300,400,600&subset=latin-ext,latin);
./wp-content/themes/twentyfourteen/functions.php: $font_url = add_query_arg( $query_args, ‘//fonts.googleapis.com/css’
);
./wp-content/themes/twentyfifteen/functions.php: ), ‘//fonts.googleapis.com/css’ );
./wp-content/themes/twentythirteen/functions.php: $fonts_url = add_query_arg( $query_args, “//fonts.googleapis.com/css”
);
所以需要挨个替换。替换后的结果如下:
[forlong401 wordpress]# grep -r “useso” .
./wp-includes/script-loader.php: $open_sans_font_url = “//fonts.useso.com/css?family=Open+Sans:300italic,400italic,600italic,300,400,600&subset=$subsets”;
./wp-includes/js/tinymce/plugins/compat3x/css/dialog.css:@import url(//fonts.useso.com/css?family=Open+Sans:300italic,400italic,600italic,300,400,600&subset=latin-ext,latin);
./wp-content/themes/twentyfourteen/functions.php: // licong changes fonts from googleapis to useso.
./wp-content/themes/twentyfourteen/functions.php: $font_url = add_query_arg( $query_args, ‘//fonts.useso.com/css’ );
./wp-content/themes/twentyfifteen/functions.php:// licong changes fonts from googleapis to useso.
./wp-content/themes/twentyfifteen/functions.php: ), ‘//fonts.useso.com/css’ );
./wp-content/themes/twentythirteen/functions.php:// licong changes fonts from googleapis to useso.
./wp-content/themes/twentythirteen/functions.php: $fonts_url = add_query_arg( $query_args, “//fonts.useso.com/css” );