在Wordpress functions.php中包含JS库

时间:2016-02-07 13:31:17

标签: javascript php wordpress

我在将.js库添加到functions.php文件时遇到问题。这是文件的完整代码:

<?php
function child_theme_styles() {
    wp_enqueue_style( 'child-theme-style', get_stylesheet_uri(), array('nudie'), '1.0' );
}    
add_action( 'wp_enqueue_scripts', 'child_theme_styles');
function wp_adding_scripts() {

    wp_register_script( 'easing', get_stylesheet_directory_uri() . '/assets/js/jquery.easing.min.js', array( 'jquery' ), '1.1', true );
    wp_enqueue_script( 'easing' );

    wp_register_script( 'scrolling-nav', get_stylesheet_directory_uri() . '/assets/js/scrolling-nav.js', array( 'jquery' ), '1.1', true );    
    wp_enqueue_script( 'scrolling-nav' );

    wp_register_script( 'scrollreveal', get_stylesheet_directory_uri() . '/assets/js/scrollreveal.js', array( 'jquery' ), '1.1', true );
    wp_enqueue_script( 'scrollreveal' );

}
add_action( 'wp_enqueue_scripts', 'wp_adding_scripts', 20 );

所有路径都是正确的,并且在关闭</body>标记之前正在加载库,但不是其中一个有效。我已经为他们设置了20的优先级,所以他们在其他一切之后被加载了,但这对我也没有帮助。

0 个答案:

没有答案
相关问题