用户登录
用户注册

分享至

wordpress解决google字体

  • 作者: 朝天R大象
  • 来源: 51数据库
  • 2020-06-05

1.Wordpress如何去除google字体

WordPress最新版本已经移除Google字体,如果是WordPress 4.6版本以前的,你可以选择升级到最新版的WordPress,或者使用一下代码移除google字体: //禁用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' );以上代码来自:。

2.wordpress 怎么去除谷歌字体

wordpress 去除谷歌字体方法: 1、选择360网站卫士推出一项字体加速服务,站长只要修改一行代码,就可以免费使用到由360网站卫士CDN加速的字体服务。

2、去除谷歌字体,修改为360网站卫士字体方法如下: (1)打开网站的FTP工具,下载wordpress博客文件中的文件wp-includes/script-loader.php文件。 (2)下载到桌面上,然后通过EditPlus工具打开script-loader.php,搜索fonts.googleapis.com找到这行代码: $open_sans_font_url = “//fonts.googleapis.com/css?family1=Open+Sans:300italic,400italic,600italic,300,400,600&subset=$subsets”;(3)把fonts.googleapis.com替换为fonts.useso.com; 3、修改完保存,再次刷新可以发现网站速度已经比以前快了很多。

3.Wordpress如何去除google字体

主题文件夹下function.php中加入如下代码

/*********************禁用Google字体***************/

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;

4.去除加载谷歌字体解决wordpress网站加载google字体的几种办法

第一种方法:安装Disable Google Font插件,但经过测试之后,没有明显效果。(不推荐)

第二种方法:注释或删除掉style.css和function.php有关加载Google字体的代码fonts.googleapis.com即可。

第三种方法:将以下代码添加到主题目录下的functions.php中

如果在更改style.css或function.php文件之后,wordpress网站报错,无法打开,或者新建文章时上传图片失败。一定是将wordpress文件的编码保存为非ANSI编码,用记事本打开,保存时选择编码ANSI替换掉原来的文件即可。

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;

不会的可以来小小WP 看看 或者留言给我

5.WordPress如何去掉谷歌字体

//去除谷歌字体if (!function_exists('remove_wp_open_sans')) :function remove_wp_open_sans() {wp_deregister_style( 'open-sans' );wp_register_style( 'open-sans', false );}// 前台删除Google字体CSSadd_action('wp_enqueue_scripts', 'remove_wp_open_sans');// 后台删除Google字体CSSadd_action('admin_enqueue_scripts', 'remove_wp_open_sans');endif;将代码添加到当前使用的主题的functions.php文件中即可。

6.wordpress如何去掉主题里的google字体

方法一:搜索这个插件“ Disable Google Fonts ”,安装并激活,对于某些网站是管用的,但我管理的几个WordPress网站,用此插件无效。

方法二:修改这个文件 \wp-includes\script-loader.php,找到:fonts.googleapis,替换成:fonts.useso做了这一步,有几个网站后台速度正常了,但是不是所有的WordPress网站都能找到这句话。方法三:如果你用的商业主题,是从正规渠道购买的是正版,可以联系主题的作者提供技术支持,他会告诉你哪些文件的哪些地方存在谷歌字体链接,顺便把谷歌地图的代码也注释掉。

通常是在主题目录中的styles.css文件中。

转载请注明出处51数据库 » wordpress解决google字体

软件
前端设计
程序设计
Java相关