duanfei1975 2014-04-08 18:44
浏览 67
已采纳

wordpress将一些脚本排入队列并留下其他脚本

I'm using the function below to register and enqueue scripts in my function.php file. The problem is ONLY one script (custom.js) doesn't seem to enqueue....when I view the source of my page here: http://dev1.envisionwebdesign.co/features/ custom.js is not loaded. Any thoughts?

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' ); 
  • 写回答

1条回答 默认 最新

  • 普通网友 2014-04-08 18:46
    关注

    Simply change

    wp_enqueue_style( 'custom' ); 
    

    to

    wp_enqueue_script( 'custom' ); 
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制
  • ¥20 usb设备兼容性问题
  • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
  • ¥15 安装svn网络有问题怎么办
  • ¥15 vue2登录调用后端接口如何实现