This article requires the GP Limit Dates perk. Buy Gravity Perks today to get this perk plus 25 other galatic Gravity Forms plugins!
GP Limit Dates provides an easy-to-use user interface for limiting selectable dates in a Gravity Form Date field. By default, we designed the user interface to give you complete control over the selectable dates.
But what if you wanted to select a large block of dates to disable? For example, the entire summer?
You could certainly go through manually and limit each day of the summer but this would take some time to do and besides, we have a better solution for you!
In this article, we will show you how to block a date range with Gravity Forms Datepicker.
How do I get started?
- Install and activate Gravity Forms, Gravity Perks, and GP Limit Dates.
- Copy and paste the snippet into your theme’s functions.php file.
- Modify the “Start Date” and “End Date” options at the top of the snippet to meet your needs. Full usage instructions are below.
Usage
Once installed, this snippet is easy to configure.
Designate Your Date Field
Replace the numeric values in the filter name with your Gravity Forms form ID (FORMID) and the Date field ID (FIELDID).
gpld_limit_dates_options_FORMID_FIELDID
Specify Your Date Range
Find the
View this code snippet on GitHub.$start_date
and$end_date
variables at the top of the code snippet. Replace each with the dates for your desired date range. The dates should be specified in the “YYYY-MM-DD” format.Admire Your Handiwork
That’s all folks!
How’d that work for you? Leave us a comment below.