Countdown
Countdown Shortcode
This shortcode calculates the hours, minutes, and seconds until a specified date. It is used on the footer of the homecoming website to countdown how long it is until the next homecoming event.
If this plugin isn’t already enabled on your website, put in a plugin request using our Web Request Form.
Shortcode: Countdown
Once the plugin is enabled you’ll need to add the code below to a Shortcode block. Three attributes are required: id, start_date, and end_date. If any of them is missing, the shortcode prints an error message instead of the countdown. The remaining attributes are optional.
Optional Attributes
| Attribute | Default | Description |
|---|---|---|
direction | down | Count down to the end date, or up from the start date. |
format | HMS | Which units to show, as any combination of Y, O, W, D, H, M and S (years, months, weeks, days, hours, minutes, seconds). For example DHMS. |
timezone | your site’s timezone | The UTC offset the countdown counts against, as a whole number of hours. Leave it off unless you need to override the site’s timezone. See the note below. |
description | empty | A label displayed with the countdown. |
layout | empty | A custom layout string for the countdown, if you need something other than the default arrangement. |
expiry_text | empty | Intended to display text once the countdown reaches zero. This attribute currently has no effect. |
expiry_url | empty | Intended to send visitors to a URL once the countdown reaches zero. This attribute currently has no effect. |
A note on timezone
You do not normally need this attribute. If you leave it off, the countdown uses your site’s timezone setting and accounts for daylight saving time on its own, so a countdown to a January date and a countdown to a July date are both correct without any change on your part.
Set it only when you want the countdown to run against a timezone other than your site’s. The value is a UTC offset in whole hours, so Eastern Standard Time is -5 and Eastern Daylight Time is -4. An offset you set by hand is fixed, which means it will not follow daylight saving time and you will need to change it yourself when the clocks change.
If an existing countdown on your site already has a timezone value, it keeps using it. Removing the attribute is what lets the countdown pick up your site’s timezone instead.
Shortcode Example:
[wfu_countdown id="test" format="DHMS" start_date="2018-01-01" end_date="2023-09-16"]
