Google Calendar Availability
Reads a Google Calendar and exposes free busy blocks for a front end calendar.
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/steezrcom/wp-gcal-availability/archive/refs/heads/main.zipGCal Availability
A production-ready WordPress plugin that displays Google Calendar availability with a modern, interactive interface.
Features
- 🗓️ Beautiful Calendar UI - Powered by FullCalendar 6.x
- ⚡ Smart Caching - Configurable transient caching (default: 5 minutes)
- 🔒 Secure - Rate limiting, input validation, and WordPress security best practices
- 🌍 Internationalized - Multi-language support with translation-ready code
- 📱 Responsive - Works perfectly on all devices
- ⚙️ Easy Configuration - WordPress admin interface for settings
- 🎨 Customizable - Shortcode attributes for flexible display options
- 📊 Debug Logging - Optional error logging for troubleshooting
- ⏰ Timezone Aware - Proper handling of timezones and all-day events
Installation
- Upload the plugin folder to
/wp-content/plugins/ - Activate the plugin through WordPress admin
- Go to Settings > Calendar Availability
- Enter your Google Calendar secret iCal URL
- Configure cache duration and other settings
- Add the shortcode to any page:
[club_availability_calendar]
Getting Your Google Calendar iCal URL
- Open Google Calendar
- Click the three dots next to your calendar name
- Select Settings and sharing
- Scroll to Integrate calendar
- Copy the Secret address in iCal format
⚠️ Important: Keep this URL secret! Anyone with this URL can view your calendar events.
Usage
Basic Shortcode
[gcal_availability_calendar]
With Custom Attributes
[gcal_availability_calendar initial_view="timeGridWeek" locale="en" first_day="0"]
Available Attributes
| Attribute | Default | Options | Description |
|---|---|---|---|
initial_view |
dayGridMonth |
dayGridMonth, timeGridWeek, timeGridDay |
Initial calendar view |
locale |
cs |
Any valid locale code | Language for calendar interface |
first_day |
1 |
0 (Sunday), 1 (Monday) |
First day of the week |
Configuration
Admin Settings
Navigate to Settings > Calendar Availability to configure:
- iCal URL - Your Google Calendar secret iCal link
- Cache Duration - How long to cache calendar data (minimum 60 seconds)
- Enable Logging - Turn on debug logging to WordPress error log
Cache Management
Use the Clear Cache button in admin settings to force a fresh fetch of calendar data.
Technical Details
Caching Strategy
- Calendar data is cached using WordPress transients
- Default cache duration: 5 minutes (300 seconds)
- Configurable via admin settings (minimum 60 seconds)
- Cache keys are based on date range to optimize performance
Rate Limiting
- Maximum 30 requests per minute per IP address
- Prevents abuse and excessive API calls
- Returns HTTP 429 when limit exceeded
Security Features
- Input sanitization and validation
- WordPress nonce verification for admin actions
- Rate limiting on REST API endpoints
- Secure URL handling
- No hardcoded credentials
REST API Endpoint
GET /wp-json/gcal/v1/availability?start=2025-01-01&end=2025-01-31
Parameters:
start(required) - Start date in Y-m-d formatend(required) - End date in Y-m-d format- Maximum range: 90 days
Response:
[
{
"start": "2025-01-15T10:00:00+00:00",
"end": "2025-01-15T11:00:00+00:00"
}
]
Development
File Structure
gcal-availability/
├── assets/
│ ├── css/
│ │ └── calendar.css # Calendar styles
│ └── js/
│ └── calendar.js # Calendar JavaScript
├── includes/ # PHP classes (future use)
├── languages/ # Translation files
├── docs/ # Documentation
├── gcal-availability.php # Main plugin file
├── uninstall.php # Cleanup on uninstall
├── readme.txt # WordPress.org readme
├── README.md # Developer documentation
└── package.sh # Packaging script
Requirements
- WordPress 5.8+
- PHP 7.4+
- FullCalendar 6.x (loaded via CDN)
Debugging
Enable logging in Settings > Calendar Availability to write debug messages to the WordPress error log.
View logs:
tail -f wp-content/debug.log
Troubleshooting
Calendar not displaying
- Check that iCal URL is configured in settings
- Verify the iCal URL is accessible
- Enable logging and check error log
- Clear cache and try again
Events not showing
- Verify date range includes events
- Check timezone settings in Google Calendar
- Clear plugin cache
- Enable logging to see API responses
Performance issues
- Increase cache duration in settings
- Reduce date range displayed
- Check server resources
Support
For issues, questions, or contributions, please contact the developer or open an issue in the repository.
License
GPLv2 or later
Credits
- Built with FullCalendar
- Developed for WordPress