ACF Multi Date Picker
A WordPress ACF custom field for selecting multiple dates across multiple months. Features Flatpickr calendar, PHP date() format support, and array storage for easy front-end retrieval.
by Your Name · github.com/sambondareff/acf-multidate-picker · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/sambondareff/acf-multidate-picker/archive/refs/heads/main.zipA custom Advanced Custom Fields (ACF) field type that allows users to select multiple dates across multiple months using an interactive calendar picker.
Features
- Select multiple dates across different months
- Clean and intuitive calendar interface powered by Flatpickr
- Dates stored as an array for easy front-end retrieval
- Customizable date format using PHP's date() function syntax
- Configurable minimum and maximum date restrictions
- Option to set first day of week (Sunday or Monday)
- Individual date removal
- Responsive design that works with WordPress admin
Requirements
- WordPress 5.0 or higher
- Advanced Custom Fields (ACF) 5.0 or higher (Free or Pro version)
- PHP 7.0 or higher
Installation
- Download the plugin folder
- Upload the
acf-multidate-picker-pluginfolder to your/wp-content/plugins/directory - Activate the plugin through the 'Plugins' menu in WordPress
- The "Multi Date Picker" field type will now be available in ACF field groups
Usage
Adding the Field
- Go to Custom Fields → Field Groups in your WordPress admin
- Create a new field group or edit an existing one
- Add a new field and select "Multi Date Picker" as the field type
- Configure the field settings:
- Date Format (Storage): Format for storing dates in the database (default:
Y-m-d) - Display Format: Format for displaying dates in the picker (default:
F j, Y) - First Day of Week: Choose Sunday or Monday
- Minimum Date: Prevent selection before this date (e.g.,
today,+1 week) - Maximum Date: Prevent selection after this date (e.g.,
+1 year,2025-12-31)
- Date Format (Storage): Format for storing dates in the database (default:
Date Format Options
Use PHP date() format characters:
Common formats:
Y-m-d→ 2025-12-31m/d/Y→ 12/31/2025d/m/Y→ 31/12/2025F j, Y→ December 31, 2025M j, Y→ Dec 31, 2025l, F j, Y→ Tuesday, December 31, 2025
Format characters:
Y- Four digit year (2025)y- Two digit year (25)m- Month with leading zeros (01-12)n- Month without leading zeros (1-12)F- Full month name (January)M- Short month name (Jan)d- Day with leading zeros (01-31)j- Day without leading zeros (1-31)l- Full day name (Monday)D- Short day name (Mon)
Full PHP date format reference
Retrieving Values in Templates
The field returns an array of dates in your specified storage format.
Basic Usage
<?php
$dates = get_field('your_field_name');
if ($dates) {
echo '<ul>';
foreach ($dates as $date) {
echo '<li>' . $date . '</li>';
}
echo '</ul>';
}
?>
Format Dates for Display
<?php
$dates = get_field('your_field_name');
if ($dates) {
echo '<ul>';
foreach ($dates as $date) {
// Convert stored date to DateTime object
$date_obj = DateTime::createFromFormat('Y-m-d', $date);
// Format for display
echo '<li>' . $date_obj->format('F j, Y') . '</li>';
}
echo '</ul>';
}
?>
Sort and Filter Dates
<?php
$dates = get_field('your_field_name');
if ($dates) {
// Sort dates (they're already sorted, but you can reverse or customize)
sort($dates);
// Get only future dates
$today = date('Y-m-d');
$future_dates = array_filter($dates, function($date) use ($today) {
return $date >= $today;
});
// Display
foreach ($future_dates as $date) {
$date_obj = DateTime::createFromFormat('Y-m-d', $date);
echo '<div>' . $date_obj->format('l, F j, Y') . '</div>';
}
}
?>
Count Selected Dates
<?php
$dates = get_field('your_field_name');
$count = $dates ? count($dates) : 0;
echo "Total dates selected: " . $count;
?>
Check if Specific Date is Selected
<?php
$dates = get_field('your_field_name');
$check_date = '2025-12-25';
if ($dates && in_array($check_date, $dates)) {
echo 'Christmas is selected!';
}
?>
Field Settings Reference
| Setting | Description | Example Values |
|---|---|---|
| Date Format (Storage) | How dates are stored in database | Y-m-d, m/d/Y, d/m/Y |
| Display Format | How dates appear in admin picker | F j, Y, m/d/Y, d/m/Y |
| First Day of Week | Calendar starting day | Sunday (0), Monday (1) |
| Minimum Date | Earliest selectable date | today, +1 week, 2025-01-01 |
| Maximum Date | Latest selectable date | +1 year, 2025-12-31 |
Support
For issues or feature requests, please contact the plugin author.
License
This plugin is licensed under GPLv2 or later.
Credits
- Built on Flatpickr by Gregory Petrosyan
- Designed for Advanced Custom Fields by Elliot Condon