BrightLeaf Digital Code Snippet Library
Check out our growing library of code snippets for Gravity Forms!
Countdown Timer Shortcode
GOAL
Creates a real-time countdown timer displaying days, hours, minutes, and seconds until a specified date. Uses WordPress timezone settings and validates date input.
CONFIGURATION
- CSS: Style classes .countdown-timer, .countdown-segment, .countdown-number, .countdown-label
- WordPress: Ensure timezone is set correctly in Settings > General
- Date Format: Must use dd/mm/yyyy format (e.g., 31/12/2025)
- Accepts an optional
end_textto show when the timer countdown is finished. - Accepts an optional
time(in 24 hour format) attribute to configure what time of day. Useful for offsetting against timezones. Can be HH:MM or HH:MM:SS format.
USAGE
[countdown date="31/12/2025"] [countdown date="01/01/2026"]
NOTES
Supports multiple timers on same page via static counter
Countdown stops at zero (doesn't go negative)
Uses site timezone from WordPress settings
JavaScript updates every second
Timer starts automatically on page load
Falls back gracefully with error messages for invalid dates
Install Using Code Snippets
This code is best installed directly on your site using the Code Snippets plugin.
Check Out the Code
Loading...
Stay Updated On This Snippet
Review this entry
You must be logged in to post a comment.