我使用以下方式从wordpress插件代码调用javascript文件:
add_action(\'init\',\'gallery_sugar_js_init\');
function gallery_sugar_js_init() {
wp_enqueue_script( \'gallery_sugar_js\', plugins_url( \'/js/gallery_sugar.js\', __FILE__ ));
}
但在WordPress的源代码中,我看到了这一点(首先加载我的javascript文件):
<script type=\'text/javascript\' src=\'http://localhost/projects/lightbox/wp-content/plugins/custom-gallery/js/gallery_sugar.js?ver=3.7\'></script>
<script type=\'text/javascript\' src=\'http://localhost/projects/lightbox/wp-includes/js/jquery/jquery.js?ver=1.10.2\'></script>
如何确保jquery首先加载到Wordpress插件文件中?