Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1417951

    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!

    #1417963

    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

    #1417978

    Thank you! Very helpful.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.