Skip to content

Instantly share code, notes, and snippets.

@mattyza
Created April 2, 2014 08:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattyza/85d03109413aabf74e79 to your computer and use it in GitHub Desktop.
Save mattyza/85d03109413aabf74e79 to your computer and use it in GitHub Desktop.
Adjust the datepicker in the Checkout Field Editor plugin.
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', 'changeYear', true );
jQuery( '.checkout-date-picker' ).datepicker( 'option', 'yearRange', '-40:+0' );
}
});
</script>
<?php
}
} // End custom_adjust_datepicker_range()
add_action( 'wp_footer', 'custom_adjust_datepicker_range', 50 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment