html - 排队脚本未显示在头部

标签 html css wordpress

我正在我的 functions.php 文件中排队和注册脚本。我有三个文件(2 个 js 和 1 个 css),但当我检查浏览器中的输出时,三个文件中只有 2 个出现在我的 head html 中。

functions.php代码

/* Quene & register new .css and .js */
function new_styles() {
wp_register_style( 'Wembley-prototype', get_stylesheet_directory_uri() . '/css/fx_theme.css');
wp_register_script( 'Wembley-prototype', get_stylesheet_directory_uri() . '/js/skrollr.js', array( 'jquery' ));
wp_register_script( 'Wembley-prototype', get_stylesheet_directory_uri() . '/js/mobile-fix.js', array( 'jquery' ));

wp_enqueue_style( 'Wembley-prototype', get_stylesheet_directory_uri() . '/css/fx_theme.css');
wp_enqueue_script( 'Wembley-prototype', get_stylesheet_directory_uri() . '/js/skrollr.js');
wp_enqueue_script( 'Wembley-prototype', get_stylesheet_directory_uri() . '/js/mobile-fix.js');
}

add_action( 'wp_enqueue_scripts', 'new_styles', 20);

mobile-fix.js 无法识别。这两个 js 文件位于同一个 js 文件夹中。

最佳答案

当您注册脚本时,$handle(字符串)(必需)脚本的名称。应该是唯一,因为它用作以后与 wp_enqueue_script() 一起使用的句柄。

wp_register_script( 'my-script-1', /* parameters */ );
wp_register_script( 'my-script-2', /* parameters */ );

wp_enqueue_script( 'my-script-1' );
wp_enqueue_script( 'my-script-2' );

关于html - 排队脚本未显示在头部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30014483/

相关文章:

javascript - 全屏上的 HTML5 视频使用 jquery/javascript 旋转屏幕,就像在移动设备中的 YouTube 上一样?

wordpress - 安全地存储插件特定数据

html - Z-index 不会让一个元素出现在其他元素之上

html - 我们如何使用和控制渐变

html - Flexbox "nowrap"值不起作用

javascript - 如何使轮播中的内容垂直居中?

css - 清除火狐字体缓存

css - Laravel 5.6 无法导入 css 文件

wordpress - 解析 header X-XSS-Protection : 1; Over SSL 时出错

wordpress - WooCommerce 网站中的单独注册页面