-
-
Save joshfeck/a5b179dd8a1e18be9629d9dce9987239 to your computer and use it in GitHub Desktop.
EE3 display custom timezone using a hook
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
<?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"> </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