[WP插件]Open Fonts替换

痕风 2014年6月19日09:31:251 51

最近由于Google Open Fonts的众所周知的大姨妈问题,WordPress博客普遍出现了访问很慢的状况。

/**
 * Plugin Name: Replace Google Fonts
 * Plugin URI:  http://www.soulteary.com/2014/06/08/replace-google-fonts.html
 * Description: Use Qihoo 360 Open Fonts Service to replace Google's.
 * Author:      soulteary
 * Author URI:  http://www.soulteary.com/
 * Version:     1.0
 * License:     GPL
 */
 
/**
 * Silence is golden
 */
if (!defined('ABSPATH')) exit;
 
class Replace_Google_Fonts
{
 
    /**
     * init Hook
     *
     */
    public function __construct()
    {
        add_filter('style_loader_tag', array($this, 'ohMyFont'), 888, 4);
    }
 
 
    /**
     * Use Qihoo 360 Open Fonts Service to replace Google's.
     *
     * @param $text
     * @return mixed
     */
    public function ohMyFont($text)
    {
        return str_replace('//fonts.googleapis.com/', '//fonts.useso.com/', $text);
    }
}
 
/**
 * bootstrap
 */
new Replace_Google_Fonts;
插件下载:Replace-Google-Fonts 
weinxin
痕风的起点
专注于互联网资讯、中央空调、Windows、wordpress、建站技术、软件应用等相关网络资源的分享。
匿名

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

评论:1   其中:访客  1   博主  0
    • 惵霏的爱 惵霏的爱 3

      真好