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!
wp_enqueue_script('jquery-ui-checkboxradio');
I dont see the dependency in the reference https://developer.wordpress.org/reference/functions/wp_enqueue_script/
Is it not
jquery-ui-button
or
jquery-ui-form
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 .
I am a bit late, but in case you did not find the answer, your url for the jquery-ui "base" style is incorrect. The current version of jquery ui in wordpress is 1.11.4. If you go to //ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/base/jquery-ui.css, you get a 404. I don't see that the base style is available through http://code.jquery.com/ui/ with version 1.11.4, but it is available for version 1.12.1. So I would suggest selecting a different style or seeing if the newest stable version of the base style works.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.