我正在构建引导程序/WordPresssite 我对引导有问题。在jquery之前加载min.js,这会导致导航无法正常工作等问题。
下面是我将脚本放入队列的方式。
function turtles_scripts() {
wp_enqueue_style( \'turtles-bootstrap-min\', get_template_directory_uri() . \'/css/bootstrap.min.css\', array(), null, \'all\' );
wp_enqueue_style( \'turtles-style\', get_stylesheet_uri() );
wp_enqueue_script( \'turtles-bootstap-min-js\', get_template_directory_uri() . \'/js/bootstrap.min.js\', array(), \'null\', true );
wp_enqueue_script( \'turtles-navigation\', get_template_directory_uri() . \'/js/navigation.js\', array(), \'20120206\', true );
wp_enqueue_script( \'turtles-skip-link-focus-fix\', get_template_directory_uri() . \'/js/skip-link-focus-fix.js\', array(), \'20130115\', true );
if ( is_singular() && comments_open() && get_option( \'thread_comments\' ) ) {
wp_enqueue_script( \'comment-reply\' );
}
}
add_action( \'wp_enqueue_scripts\', \'turtles_scripts\' );
然而,当我查看页面源代码时。引导程序在jQuery之前加载:
<script type=\'text/javascript\' src=\'http://turtles.opteradev.com/wp-content/themes/turtles/js/bootstrap.min.js?ver=null\'></script>
<script type=\'text/javascript\' src=\'http://turtles.opteradev.com/wp-content/themes/turtles/js/navigation.js?ver=20120206\'></script>
<script type=\'text/javascript\' src=\'http://turtles.opteradev.com/wp-content/themes/turtles/js/skip-link-focus-fix.js?ver=20130115\'></script>
<script type=\'text/javascript\' src=\'http://turtles.opteradev.com/wp-includes/js/jquery/jquery.js?ver=1.11.1\'></script>
<script type=\'text/javascript\' src=\'http://turtles.opteradev.com/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.2.1\'></script>
<script type=\'text/javascript\' src=\'http://turtles.opteradev.com/wp-content/plugins/ml-slider/assets/sliders/flexslider/jquery.flexslider-min.js?ver=3.2.1\'></script>
<script type=\'text/javascript\' src=\'http://turtles.opteradev.com/wp-content/plugins/ml-slider-pro/assets/public.js?ver=2.5.1\'></script>
<script type=\'text/javascript\' src=\'http://turtles.opteradev.com/wp-content/plugins/eventON/assets/js/jquery.mobile.min.js?ver=1\'></script>