http://androidren.com/index.php?qa=305&qa_1=wordpress-%E4%B8%AD-google-%E5%AD%97%E4%BD%93%E7%9A%84%E6%9C%80%E4%BD%B3%E6%9B%BF%E4%BB%A3%E6%96%B9%E6%A1%88
http://forlong401.com/?p=1327
下面所述基于: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” );