Desidero datidore a chi in un modulo nella mia pagina di modello wordpress, ma non funziona.Utilizzare jquery datepicker in wordpress
Questo è il codice che ho il functions.php tema bambino:
function modify_jquery() {
if (!is_admin()) {
// comment out the next two lines to load the local copy of jQuery
wp_deregister_script('jquery');
wp_register_script('jquery', 'http://ajax.googleapis.com/ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js', false, '2.1.1');
wp_enqueue_script('jquery');
}
}
add_action('init', 'modify_jquery');
function load_jquery_ui_google_cdn() {
global $wp_scripts;
wp_enqueue_script('jquery-ui-core');
wp_enqueue_script('jquery-ui-slider');
// get the jquery ui object
$queryui = $wp_scripts->query('jquery-ui-core');
// load the jquery ui theme
$urlui = "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.8/jquery-ui.min.js";
wp_enqueue_style('jquery-ui-smoothness', $urlui, false, null);
}
add_action('wp_enqueue_scripts', 'load_jquery_ui_google_cdn');
Poi ho questo page-mypage.php:
<script>
$(function() {
$("#datepicker").datepicker();
});
</script>
...other code...
Date: <input type="text" id="datepicker">
...other code...
</form>
Ma non mostra . Potresti aiutarmi a capire cosa c'è che non va?
L'URL di jQuery sembra sbagliato (si hanno 'ajax.googleapis.com/ajax.googleapis.com'). Hai inserito 'datepicker()' ovunque? Penso che sia parte dell'interfaccia utente di jQuery, non di base jQuery – Hobo
@Hobo Grazie per la tua risposta, ho aggiunto l'interfaccia utente di jQueryi come mostrato nel primo post, ma ancora non funziona, – testermaster