Hi there!
In my contact form I want to give people the opportunity to select a date only from one week after today on.
Example: If today is the 1. September 2023 I want the first available dates be from the 8. September on.
Is there a way to do this?
Thank you!
there are nice plugins to influence datepicker f.e.: Datepicker by input
but you can insert that snippet to your child-theme functions.php
( if you get rid of those outcommented signs “//” – the weekends will be unavailable too ):
( there is a prebuild option for no Weekend)
function my_datepicker_defaults() {
?>
<script type="text/javascript">
window.addEventListener("DOMContentLoaded", function () {
(function($) {
$.datepicker.setDefaults({
// beforeShowDay: $.datepicker.noWeekends,
minDate: "+7d",
maxDate: "+12m",
});
}(jQuery));
});
</script>
<?php
}
add_action('wp_footer', 'my_datepicker_defaults', 20);
if you do not need maxDate remove that line
Thank you! Very helpful.