我想在我的WordPress站点页脚中添加j查询文件,我已经这样做了。但问题是,每当我在我的WordPress站点页脚中添加j查询文件时,滑块革命就会显示出这样的错误。
旋转滑翔机错误:在革命文件js包含之后有一些jquery.js库包含。这包括了make消除了革命滑块库,并使其无法工作。找到双jquery.js包含并删除它。
当我删除j查询时,滑块革命就会正常工作。但是我想为我的工作添加j查询2.2.1,但我不能。我是如何修复它的?
发布于 2019-07-02 09:08:46
可以在这里找到解决方案:https://stackoverflow.com/a/23551006/3933603,from @deweydb。
在主题文件夹的function.php文件中添加以下行:
//remove the default jQuery script
add_filter( 'wp_default_scripts', 'change_default_jquery' );
function change_default_jquery( &$scripts){
if(!is_admin()){
$scripts->remove('jquery');
}
}
//inject a new one from a remote source
add_action('wp_enqueue_scripts', 'ocean_theme_scripts');
function ocean_theme_scripts() {
if(!is_admin()){
wp_register_script('jquery221', '//code.jquery.com/jquery-2.2.1.min.js', null, null, true);
wp_enqueue_script('jquery221');
}
}发布于 2019-07-02 08:01:42
如果您正在使用任何缓存插件,如wp最快缓存、自动优化等,那么请删除它,并检查它是否工作,因为这个错误是由于jquery冲突而引发的。如果它在禁用插件后工作,这意味着缓存插件存在问题。
https://stackoverflow.com/questions/56847322
复制相似问题