SHARE
TWEET

Date Picker Specific Date Ranges

eventsmanager Jun 8th, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /*
  3. This snippet changes a datepicker option values for a specific datepicker field, edit the .input-field-dates to your specific form class names.
  4.  
  5. For installation instructions, please visit http://wp-events-plugin.com/tutorials/how-to-safely-add-php-code-to-wordpress/
  6. */
  7. function my_em_datepicker_vals(){
  8.     ?>
  9.     <script type="text/javascript">
  10.         jQuery(document).ready(function(){
  11.             var date = new Date();
  12.             //in this example, we're going back 19 years for a specific field
  13.             date.setFullYear( date.getFullYear() - 19 );
  14.             //.input-field-dates is a class assigned to the encapsulating wrapper tag around the date fields, check your source code for your specific class name
  15.             jQuery('.input-field-dates .em-date-start').datepicker('option', 'minDate', date);
  16.         });
  17.     </script>
  18.     <?php
  19. }
  20. add_action('wp_head','my_em_datepicker_vals',1000);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top