我正在使用下面的函数在我的函数.php文件中注册和排队脚本。问题是只有一个脚本(自定义.js)似乎没有排队......当我在此处查看我的页面源代码时:http://dev1.envisionwebdesign.co/features/自定义.js未加载。有什么想法吗?
function register_my_scripts() {
wp_register_script( 'bootstrap', get_template_directory_uri() . '/js/bootstrap.min.js', array( 'jquery' ),null, true );
wp_register_script( 'nicescroll', get_template_directory_uri() . '/js/jquery.nicescroll.min.js', array( 'jquery' ),null, true );
wp_register_script( 'custom', get_template_directory_uri() . '/js/custom.js', array( 'jquery','nicescroll' ),null, true );
wp_enqueue_script('jquery');
wp_enqueue_script( 'bootstrap' );
wp_enqueue_script( 'nicescroll' );
wp_enqueue_style( 'custom' );
}
add_action( 'wp_enqueue_scripts', 'register_my_scripts' );
只需更改
wp_enqueue_style( 'custom' );
自
wp_enqueue_script( 'custom' );