Javascript Woocommerce签出字段编辑器、日期选择器限制日期数组并限制最近的5天

Javascript Woocommerce签出字段编辑器、日期选择器限制日期数组并限制最近的5天,javascript,jquery,wordpress,woocommerce,Javascript,Jquery,Wordpress,Woocommerce,我想也许我的问题没有弄清楚 我想用jquery datepicker做两件事(在本例中,它是woocommerce自定义签出字段加载项的一部分) 1:禁用日历中接下来的5天。 2:禁用某些日期/时段,如节假日、休息日等 我已经能够通过以下功能分别实现这两个功能,但当我同时使用它们时,它们都不起作用。那么只有#2起作用。 有什么好的建议吗 到目前为止,我如何将这两个功能结合起来: 这个人限制了最近的5天 add_filter( 'wp_footer' , 'woo_add_checkout_fie

我想也许我的问题没有弄清楚

我想用jquery datepicker做两件事(在本例中,它是woocommerce自定义签出字段加载项的一部分)

1:禁用日历中接下来的5天。 2:禁用某些日期/时段,如节假日、休息日等

我已经能够通过以下功能分别实现这两个功能,但当我同时使用它们时,它们都不起作用。那么只有#2起作用。 有什么好的建议吗

到目前为止,我如何将这两个功能结合起来:

这个人限制了最近的5天

add_filter( 'wp_footer' , 'woo_add_checkout_field_date_range_limit' );
function custom_adjust_datepicker_range () {
    if ( is_checkout() ) {
        wp_enqueue_script( 'jquery' );
?>
<script type="text/javascript">
jQuery( document ).ready( function ( e ) {
    if ( jQuery( '.checkout-date-picker' ).length ) {
        jQuery( '.checkout-date-picker' ).datepicker( 'option', 'minDate', '+5' );
    }
});
</script>
<?php
    }
} // End custom_adjust_datepicker_range()
add_action( 'wp_footer', 'custom_adjust_datepicker_range', 50 );

jQuery(".checkout-date-picker").datepicker("destroy");
jQuery(".checkout-date-picker").datepicker({
不起作用


我对这个新手的问题表示歉意,我可能也能在其他地方找到答案,但话说回来。这总是一个很好的指导来源。

请尝试以下方法:jQuery('.checkout-date-picker').each(function(){$(This.datepicker(…);})@MiguelAngelMartinez不确定你的建议。你能给我更多的信息吗?
jQuery( '.checkout-date-picker' ).datepicker( 'option', 'minDate', '+5' );
jQuery(".checkout-date-picker").datepicker("destroy");
jQuery(".checkout-date-picker").datepicker({