1
tmqhliu 2014-06-17 12:32:01 +08:00
Wordpress 自带 jquery 你把这些注释掉 用 wordpress 自带的 wp_enqueue_script() 函数引入即可
|
2
WildCat 2014-06-17 12:41:18 +08:00 via iPhone
把你theme的<head>域贴出来先
|
3
belin520 2014-06-17 13:32:01 +08:00 1
打开wordpress代码中的文件wp-includes/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"; 把fonts.googleapis.com替换为fonts.useso.com 或者可以将以下代码复制到主题functions.php中 function ipc_google_font($content) { return str_replace('fonts.googleapis.com', 'fonts.useso.com', $content); return str_replace('ajax.googleapis.com', 'ajax.useso.com', $content); } ob_start("ipc_google_font"); |
5
emric 2014-06-17 13:50:24 +08:00
|
6
wandero OP |
7
emric 2014-06-17 15:35:07 +08:00 1
@wandero 这是最标准的做法, 并对所有标准插件有效.
把他丢在 functions.php 尾端就好了~ (去掉前面的 <?php ) |
8
yinxingren 2014-06-17 16:26:12 +08:00
|
9
ccbikai 2014-06-17 17:34:32 +08:00 1
<?php
/** * Plugin Name: Replace Google Libs * Plugin URI: http://www.soulteary.com/2014/06/15/replace-google-libs.html * Description: Use Qihoo 360 Open Libs 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_Libs { /** * init Hook * */ public function __construct() { add_filter('wp_print_scripts', array($this, 'ohMyScript'), 1000, 1); } /** * Use Qihoo 360 Open Libs Service to replace Google's. */ public function ohMyScript() { global $wp_scripts; if($wp_scripts && $wp_scripts->registered){ foreach ($wp_scripts->registered as $libs){ $libs->src = str_replace('//ajax.googleapis.com', '//ajax.useso.com/', $libs->src); } } } } /** * bootstrap */ new Replace_Google_Libs; |