Php Jquery可以内联工作,而不是在外部文件上
我的问题很烦人也很奇怪。我已经创建了一个自定义Wordpress主题,在header.php中,我像这样加载jquery(现在不记得为什么):Php Jquery可以内联工作,而不是在外部文件上,php,jquery,html,wordpress,Php,Jquery,Html,Wordpress,我的问题很烦人也很奇怪。我已经创建了一个自定义Wordpress主题,在header.php中,我像这样加载jquery(现在不记得为什么): load(“jquery”,“1”); 昨晚,我将上面的代码替换为 <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> 然后我的网站崩溃了。我马上又换了回去,但问题依然存在。我在HTML中放置了一些Jque
load(“jquery”,“1”);
昨晚,我将上面的代码替换为
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
然后我的网站崩溃了。我马上又换了回去,但问题依然存在。我在HTML中放置了一些Jquery,它工作得很好。然后我通过注释functions.php文件中的代码禁用了插件,如下所示:
<?php
if (!is_admin()) {
wp_register_script('custom', get_stylesheet_directory_uri().'/js/custom.js');
wp_enqueue_script('custom');
wp_register_script('blockui',get_stylesheet_directory_uri().'/js/jquery.blockUI.js');
wp_enqueue_script('blockui');
wp_register_script('fancy',get_stylesheet_directory_uri().'/js/jquery.fancybox.js');
wp_enqueue_script('fancy');
wp_register_script('jeasing',get_stylesheet_directory_uri().'/js/jquery.easing.js');
wp_enqueue_script('jeasing');
wp_register_script('friendchooser',get_stylesheet_directory_uri().'/js/jquery.friendChooser.js');
wp_enqueue_script('friendchooser');
wp_register_script('zclip', get_stylesheet_directory_uri().'/js/jquery.zclip.min.js');
wp_enqueue_script('zclip');
}
?>
但问题还是出现了。有什么想法吗?第30行的custom.js文件中有语法错误。只需从那里删除
}
并且了解一些关于firebug的信息,这非常有用:)问题出在哪里?js控制台有错误吗?对不起!一切似乎都处于非活动状态…例如,在我的custom.js中,我有类似jQuery(document)的代码.ready(函数($){$('h1').hide();$('btn_剪贴板').zclip({path:'',copy:function(){return$('#剪贴板_文本').val();}});在js控制台中,如果没有任何错误/通知,这不会得到FiredWeb吗?我不太熟悉firebug(不是一个web开发人员),但我现在要试试,顺便说一下,我的测试站点现在爱上了它!
<?php
if (!is_admin()) {
wp_register_script('custom', get_stylesheet_directory_uri().'/js/custom.js');
wp_enqueue_script('custom');
wp_register_script('blockui',get_stylesheet_directory_uri().'/js/jquery.blockUI.js');
wp_enqueue_script('blockui');
wp_register_script('fancy',get_stylesheet_directory_uri().'/js/jquery.fancybox.js');
wp_enqueue_script('fancy');
wp_register_script('jeasing',get_stylesheet_directory_uri().'/js/jquery.easing.js');
wp_enqueue_script('jeasing');
wp_register_script('friendchooser',get_stylesheet_directory_uri().'/js/jquery.friendChooser.js');
wp_enqueue_script('friendchooser');
wp_register_script('zclip', get_stylesheet_directory_uri().'/js/jquery.zclip.min.js');
wp_enqueue_script('zclip');
}
?>