本帖最後由 hardrock 於 2014-12-5 23:58 編輯 ( F6 a2 j8 w1 W; K* g- C: Z6 f
4 x+ u5 k7 ] U. `, @7 L用了以下代碼後,我上自己網站慢的問題解決了,但是我網站的訪客是美國人,他們訪問我網站會不會變慢,他們看網站的字體格局會不會改變?
) d V% a/ L+ M, m* U3 I+ U! G! s# R4 {3 @$ K4 q
http://www.skyshe.cn/2014/08/26/80.html
2 W! B2 H5 d- g0 ^0 cWordPress原來字體使用的是Google Fonts Open Sans,在國內訪問不穩定所以會延時,解決方法很簡單:直接添加到主題的functions.php中即可禁用後台Open Sans: Y& G* y- I# Z" B* q' ^6 k
9 V' z& n8 ^% g8 P! ^[mw_shl_code=php,true]/** 禁用Open Sans */2 Z' C) Z% ^$ a; Q' M& ~
class Disable_Google_Fonts {
- n& Y/ C: g( I1 o: U public function __construct() {; \$ P9 Q0 {7 G! h
add_filter( 'gettext_with_context', array( $this, 'disable_open_sans' ), 888, 4 );
* Q3 ^! G" y% R8 p! _ }
4 v& |9 g& D+ x' `' L4 s* E( Q0 N public function disable_open_sans( $translations, $text, $context, $domain ) {5 |0 q, V: k7 _
if ( 'Open Sans font: on or off' == $context && 'on' == $text ) {1 X$ R6 g+ C5 l- W- P8 s
$translations = 'off';
% x: d, Y m0 R+ X" y: R# ^/ r }& ~. W7 F) g! ?
return $translations;, [! ^ F6 Y) H' H4 g
}
: u7 M+ w6 h+ v, W8 {}
' q/ n( `, w# w/ D6 x$disable_google_fonts = new Disable_Google_Fonts;[/mw_shl_code]
3 @/ ^% a r m2 W1 t* Q
- e# C' O( ]( L6 I" C# E4 N# U: `# E. R) {; S
|