在主题目录下的functions.php文件末尾加入以下代码:
class Uctheme_Disable_Google_Fonts {
public function __construct() {
add_filter( 'gettext_with_context', array( $this, 'disable_open_sans' ), 888, 4 );
}
public function disable_open_sans( $translations, $text, $context, $domain ) {
if ( 'Open Sans font: on or off' == $context && 'on' == $text ) {
$translations = 'off';
}
return $translations;
}
}
$disable_google_fonts = new Uctheme_Disable_Google_Fonts;
function remove_open_sans() {
wp_deregister_style( 'open-sans' );
wp_register_style( 'open-sans', false );
wp_enqueue_style('open-sans','');
}
add_action( 'init', 'remove_open_sans' );
function get_avatar_uctheme( $avatar ) {
$avatar = preg_replace( "/http:\/\/(www|\d).gravatar.com/","http://gravatar.duoshuo.com",$avatar );
return $avatar;
}
add_filter( 'get_avatar', 'get_avatar_uctheme' );
function disable_plugin_request($a,$b,$c){
if(isset($b['body']['plugins']) || isset($b['body']['themes']))
return array('response'=>array('code'=>404));
}
add_filter("pre_http_request", disable_plugin_request,10,3);
|