Date Picker Specific Date Ranges

Jun 8th, 2019
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.
  5. For installation instructions, please visit
  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

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add to your ad blocker whitelist or disable your adblocking software.