-
-
Save Apina/568dbb38be956f314a64 to your computer and use it in GitHub Desktop.
Shortcode to show the event countdown - basic version
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Shortcode Name: Event Countdown | |
Author: Dean Robinson | |
Description: This code uses the espresso_countdown function in time_date.php to display a countdown to the event start date | |
Usage Example: [EVENT_COUNTDOWN] | |
Requirements: | |
Notes: This needs to be added to the custom_shortcodes.php file that comes with the Custom Files Addon | |
*/ | |
function ee_event_countdown() { | |
global $this_event_id; | |
$event_id = $this_event_id; | |
//Create the countdown variables | |
$start_timestamp = espresso_event_time($event_id, 'start_timestamp'); | |
$end_timestamp = espresso_event_time($event_id, 'end_timestamp'); | |
$countdown = espresso_countdown($start_timestamp, $end_timestamp, 'This event has ended' ); | |
//Display the countup | |
return $countdown; | |
} | |
add_shortcode('EVENT_COUNTDOWN', 'ee_event_countdown'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment