BrightLeaf Digital Code Snippet Library
Check out our growing library of code snippets for Gravity Forms!
Eleven of these snippets register their own shortcodes. Every tag and attribute is in our Gravity Forms shortcodes reference. Need a Gravity Forms or GravityView shortcode built for you? Try the free shortcode builder.
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
https://raw.githubusercontent.com/BrightLeaf-Digital/snippets/main/Countdown%20Timer%20Shortcode.php
This code is best installed directly on your site using the Code Snippets plugin.
Loading...
Review this entry
You must be logged in to post a comment.