【问题标题】:wordpress enqueues some scripts and leaves otherwordpress 将一些脚本排入队列并留下其他脚本
【发布时间】:2014-04-08 18:44:26
【问题描述】:

我正在使用下面的函数在我的 function.php 文件中注册和排队脚本。问题是只有一个脚本(custom.js)似乎没有排队......当我在这里查看我的页面源时:http://dev1.envisionwebdesign.co/features/custom.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' ); 

【问题讨论】:

    标签: php wordpress


    【解决方案1】:

    简单的改变

    wp_enqueue_style( 'custom' ); 
    

    wp_enqueue_script( 'custom' ); 
    

    【讨论】:

    • 啊啊啊有时候它就在你面前。谢谢:)
    猜你喜欢
    • 2018-11-09
    • 1970-01-01
    • 2017-03-17
    • 2012-07-18
    • 1970-01-01
    • 2012-10-05
    • 2015-11-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多