Skip to content

Instantly share code, notes, and snippets.

@joshfeck
Created December 17, 2019 00:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshfeck/a5b179dd8a1e18be9629d9dce9987239 to your computer and use it in GitHub Desktop.
Save joshfeck/a5b179dd8a1e18be9629d9dce9987239 to your computer and use it in GitHub Desktop.
EE3 display custom timezone using a hook
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
function my_ee_timezone_output($event_id) {
global $wpdb;
$tz_event = $wpdb->get_var($wpdb->prepare("SELECT timezone_string FROM " . EVENTS_DETAIL_TABLE . " WHERE id = '%d'", $event_id));
if(! isset($tz_event)) {
return;
}
date_default_timezone_set($tz_event);
$html = '<p class="event_time">';
$html .= '<span class="span_event_time_label">&nbsp;</span><span class="span_event_time_value">';
$html .= '(All times are ' . date('T') . ')</span></p>';
date_default_timezone_set('UTC');
echo $html;
}
add_action('espresso_price_select', 'my_ee_timezone_output', 99, 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment