wordpress3.8 如何禁用 google 字体?

2014-06-24 18:08:03 +08:00
 hfeeki
在wordpress的网站下载了disable google font 这个插件,安装了,但是没有效果
4361 次点击
所在节点    程序员
21 条回复
gangsta
2014-06-24 18:28:32 +08:00
在functions.php写个函数就OK了

Google : WP remove open sans
belin520
2014-06-24 18:30:48 +08:00
XXOO
2014-06-24 18:32:21 +08:00
不是有360 镜像么
shiniv
2014-06-24 20:14:13 +08:00
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;
X-Force
2014-06-24 20:15:06 +08:00
decken
2014-06-24 20:25:13 +08:00
一开始我还以为是哪个插件带的, 排查了老半天也没查出来
qinix
2014-06-24 21:45:49 +08:00
webjin
2014-06-24 23:45:23 +08:00
chian
2014-06-24 23:56:48 +08:00
直接注释掉这一段
// $open_sans_font_url = "//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,300,400,600&subset=$subsets";

路径wp-includes\script-loader.php
notcome
2014-06-25 07:43:09 +08:00
这是样式写入 PHP 嘛……
coolicer
2014-06-25 09:00:33 +08:00
我那是主题加的,我直接去CSS去掉。
hisway
2014-06-25 10:05:48 +08:00
主题中查找到fonts.googleapis.com这段,直接替换成国内的字体库,百度,360都有,很好用。
johnnyR
2014-06-25 15:03:36 +08:00
这个问题这几天很火,这是我的收集: http://dalongmao.sinaapp.com/archives/144
kingme
2014-06-25 16:42:50 +08:00
安装插件,disable google font
hfeeki
2014-06-25 19:40:16 +08:00
@kingme 我上面说过,插件不起作用
hfeeki
2014-06-25 19:40:53 +08:00
@hisway 怎么替换?
谁知道怎样替换成本地字体?
hfeeki
2014-06-25 19:41:34 +08:00
@XXOO 360的镜像在哪里?怎样替换成360的镜像?
hfeeki
2014-06-25 20:29:56 +08:00
@belin520 谷歌现在国内都没法上了,你还弄个谷歌的链接,你这样会让我更加抑郁的~^~
trigger
2014-06-25 20:32:23 +08:00
@johnnyR 解决了 进后台很快
XXOO
2014-06-25 20:52:56 +08:00

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/119301

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX