douzhe3516 2017-12-31 08:28
浏览 59
已采纳

版本4.9.1 wp排队脚本无法正常工作

I am using wordpress to add a cdn , this kind of thing works well with css with wp_styles . It seems to convert the link to the localhost link plus the cdn. My code echos:

http://tavlin.daniellowes.com/wp-content/plugins/home/aborigi6/public_html/tavlin/wp-content/themes/twentyseventeen/https:/cdnjs.cloudflare.com/ajax/libs/aos/2.2.0/aos.js?ver=1.1

It should echo
https:/cdnjs.cloudflare.com/ajax/libs/aos/2.2.0/aos.js?ver=1.1

Here is the problematic php code code:

function aos() { 

        wp_register_script( 'aos', 'https://cdnjs.cloudflare.com/ajax/libs/aos/2.2.0/aos.js', array('jquery'), 3.3, true); 
        wp_enqueue_script('aos'); 

    }

    add_action('wp_enqueue_scripts', 'aos');
  • 写回答

3条回答 默认 最新

  • duanpiyao2734 2017-12-31 18:00
    关注

    You can try this:

    <?php
    
    function aos() { 
        wp_register_script( 'aos', '//cdnjs.cloudflare.com/ajax/libs/aos/2.2.0/aos.js', array('jquery'), '3.3', true ); 
        wp_enqueue_script('aos'); 
    }
    add_action('wp_enqueue_scripts', 'aos');
    
    ?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 shape_predictor_68_face_landmarks.dat
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料