Created
April 2, 2014 08:24
-
-
Save mattyza/85d03109413aabf74e79 to your computer and use it in GitHub Desktop.
Adjust the datepicker in the Checkout Field Editor plugin.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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