【发布时间】:2013-02-27 02:37:54
【问题描述】:
我正在尝试将 jQuery UI timepicker addon 添加到我的 datepicker 函数中。这些正在我的 Wordpress 安装的管理部分中加载。
脚本和样式表正在加载到标题中。我的问题是 timepicker 函数没有初始化。
日期选择器在点击时显示良好。我是不是弄乱了这里的语法?
function my_admin_init() {
wp_enqueue_script('jquery');
wp_enqueue_script('jquery-ui-core');
wp_enqueue_script('jquery-ui-datepicker', get_stylesheet_directory() . 'js/jquery-ui-1.10.1.custom.min.js', array('jquery', 'jquery-ui-core') );
wp_enqueue_script('jquery-ui-datetimepicker', get_stylesheet_directory() . 'js/timepicker.js', array('jquery', 'jquery-ui-core') );
wp_enqueue_style('jquery.ui.theme', get_stylesheet_directory_uri() . '/css/jquery-ui-1.10.1.custom.min.css');
wp_enqueue_style('jquery.timepicker.theme', get_stylesheet_directory_uri() . '/css/timepicker.css');
}
add_action('admin_init', 'my_admin_init');
function my_admin_footer() {
?>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery('#pyre_open').datepicker({
dateFormat : 'DD, d MM, yy'
});
jQuery('#pyre_open').datetimepicker();
});
</script>
<?php
}
add_action('admin_footer', 'my_admin_footer');
【问题讨论】:
标签: jquery wordpress jquery-ui jquery-ui-datepicker