最近果班扑街借呢样借果样搞到乱七八糟,好了,唔肺话了。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
function bd_change_apiscript() { global $wp_scripts; foreach ((array)$wp_scripts->registered as $thisscripts) { if (stristr($thisscripts->src, 'googleapis.com')) { wp_deregister_script($thisscripts->handle); wp_enqueue_script($thisscripts->handle, str_replace( 'googleapis.com', 'lug.ustc.edu.cn', $thisscripts->src ), $thisscripts->deps, $thisscripts->ver, $thisscripts->in_footer ); } } } /* function bd_change_apistyle() { global $wp_styles; foreach ((array)$wp_styles->registered as $thisstyle) { if (stristr($thisstyle->src, 'googleapis.com')) { wp_deregister_style($thisstyle->handle); wp_enqueue_style($thisstyle->handle, str_replace( 'googleapis.com', 'useso.com', $thisstyle->src ), $thisstyle->deps, $thisstyle->ver, $thisstyle->media ); } } } */ function bd_gettext_with_context( $translations, $text, $context, $domain ) { if ( $context === 'Open Sans font: on or off' && $text === 'on' ) { $translations = 'off'; } return $translations; } add_action('wp_print_scripts', 'bd_change_apiscript'); //add_action('wp_print_styles', 'bd_change_apistyle'); add_action('gettext_with_context', 'bd_gettext_with_context', 9999,4); |
前边两个函数是用来分别揾JS同CSS里边的googleapis,最尾个函数是关闭字体的。
直接复制去主题的functions.php里边就用得。
2016.10更新:
由于fonts.googleapis.com已经解释系国内,就唔系搞style果度了。
360的useso.com已经收咗皮了。
博主不是香港人?博文風格好少見
當然不是,用粵語寫而已。