我有一個jQuery UI的問題& jQuery主題不加載。WordPress的前端主題包括jQuery UI Checkboxradio functions.php
即時通訊使用最新的WordPress 4.6。 我的主題文件夾中使用的functions.php,香港專業教育學院添加以下代碼:
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');
在一個contact7頁面內WordPress管理香港專業教育學院補充說:
<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">
該函數被調用。所以我猜想jQuery UI或者jQuery Theme不能正確加載會出現問題。 謝謝!
謝謝!我只是試了一下,但沒有效果:( With:'wp_enqueue_script('jquery','//code.jquery.com/jquery-3.1.1.min.js');和wp_enqueue_script('jquery-ui-core ','//code.jquery.com/ui/1.12.1/jquery-ui.min.js');' –