wordpress不用插件解决谷歌字体的方法!

由于之前发过一篇wordpress禁用谷歌字体的方法,该方法是用安装插件!

由于后台插件越多导致网站打开速度慢,那么我们能不用插件就尽量别用.

本篇文章黄坤教大家如何不用插件去解决谷歌字体打开缓慢的问题.

1.首先我们找到你的站点主题的functions.php文件,在wp-content\themes\你的主题名称\的文件夹里面

2.打开functions.php ,我们会看到首页第一行的

 wordpress谷歌字体问题

3.我们只要在首页第一行代码

//禁用Open Sans
class 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 Disable_Google_Fonts;

如图:

wordpress谷歌字体问题解决方法

即可解决wordpress谷歌字体问题!

靠得住网络是一家优秀的长沙网站优化长沙网站建设公司,网址:http://www.kaodezhu.com/

唯一广告:本站承接网站建设网站优化、网站SEO诊断服务整体外包服务

靠得住网络:值得信赖的网站建设、网站优化专家,靠得住网络期待与您携手前行!手机微信同号:18974874861
靠得住网络 » wordpress不用插件解决谷歌字体的方法!

提供专业的网站建设、网站优化、小程序开发

立即查看 了解详情
cskdzcn