WordPress şablonum sayfasındaki bir formda kimin için bir tarih seçkisi istiyorum ama işe yaramıyor. Ben sayfa mypage.php bu ettik SonraJetpress'te jquery datepicker kullanın
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');
:
<script>
$(function() {
$("#datepicker").datepicker();
});
</script>
...other code...
Date: <input type="text" id="datepicker">
...other code...
</form>
Ama göstermiyor
Bu
ben çocuk tema functions.php ettik kodudur . Neyin yanlış olduğunu düşünmeme yardım eder misin?
üzerinde
bakınız ayrıntıları (eğer 'ajax.googleapis.com/ajax.googleapis.com' var). 'Datepicker()' herhangi bir yere dahil ettiniz mi? Ben jQuery UI bir parçası olduğunu düşünüyorum, jQuery değil – Hobo
@Hobo Cevabınız için teşekkürler, ben ilk yazımda gösterildiği gibi jQueryi UI ekledim, ama hala işe yaramıyor, – testermaster