duancheng1955 2016-10-11 10:44
浏览 84

Wordpress包含用于前端主题functions.php的jQuery UI Checkboxradio

I have a bit of a problem with jQuery UI & jQuery theme not loading.

Im using the latest Wordpress 4.6. Using Functions.php within my theme folder, ive added this code:

    function jquery_frontend_scripts() {
        global $wp_scripts; 
        wp_enqueue_script('jquery-core');
        wp_enqueue_script('jquery-ui-core');
        wp_enqueue_script('jquery-ui-checkboxradio'); 

        $queryui = $wp_scripts->query('jquery-ui-core'); 

        $url = "//ajax.googleapis.com/ajax/libs/jqueryui/".$queryui->ver."/themes/base/jquery-ui.css";
        wp_enqueue_style('jquery-ui-base', $url, false, null);
    }

    if (!is_admin()) add_action('wp_enqueue_scripts', 'jquery_frontend_scripts');

On a contact7 page within wordpress admin ive added:

    <script>
     jQuery(function() {
        jQuery( "input" ).checkboxradio({
          icon: false
        });
    } );
    </script>

    <legend>Välj belopp: </legend>
    <label for="radio-50">50 kr</label>
    <input type="radio" name="radio-50" id="radio-50">
    <label for="radio-200">200 kr</label>
    <input type="radio" name="radio-200" id="radio-200">
    <label for="radio-500">500 kr</label>
    <input type="radio" name="radio-500" id="radio-500">

That function is being called. So I guess there must be something wrong with jQuery UI or the jQuery Theme not loading correctly. Thanks!

  • 写回答

3条回答 默认 最新

  • dstd2129 2016-10-11 11:06
    关注

    Have you tried with specifying the source of the script, passing it as a second parameter of the function wp_enqueue_script?

    See the documentation.

    评论

报告相同问题?

悬赏问题

  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序
  • ¥15 onvif+openssl,vs2022编译openssl64
  • ¥15 iOS 自定义输入法-第三方输入法