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_text to 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...

Code Copied!
Stay Updated On This Snippet

This entry has no reviews.

Discuss or report a problem with this snippet

Post in Snippets & Custom Code with the snippet name and a link to this page.