get_settings(); // Countdown on single page is disabled if(!isset($settings['countdown_status']) or (isset($settings['countdown_status']) and !$settings['countdown_status'])) return; $event = $event[0]; $date = $event->date; $start_date = (isset($date['start']) and isset($date['start']['date'])) ? $date['start']['date'] : current_time('Y-m-d'); $end_date = (isset($date['end']) and isset($date['end']['date'])) ? $date['end']['date'] : current_time('Y-m-d'); $s_time = ''; if(!empty($date)) { $s_hour = $date['start']['hour']; if(strtoupper($date['start']['ampm']) == 'AM' and $s_hour == '0') $s_hour = 12; $s_time .= sprintf("%02d", $s_hour).':'; $s_time .= sprintf("%02d", $date['start']['minutes']); $s_time .= ' '.trim($date['start']['ampm']); } $e_time = ''; if(!empty($date)) { $e_hour = $date['end']['hour']; if(strtoupper($date['end']['ampm']) == 'AM' and $e_hour == '0') $e_hour = 12; $e_time .= sprintf("%02d", $e_hour).':'; $e_time .= sprintf("%02d", $date['end']['minutes']); $e_time .= ' '.trim($date['end']['ampm']); } $start_time = date('D M j Y G:i:s', strtotime($start_date.' '.$s_time)); $end_time = date('D M j Y G:i:s', strtotime($end_date.' '.$e_time)); // Timezone $TZO = $this->get_TZO($event); $d1 = new DateTime($start_time, $TZO); $d2 = new DateTime('now', $TZO); $d3 = new DateTime($end_time, $TZO); $countdown_method = get_post_meta($event->ID, 'mec_countdown_method', true); if(trim($countdown_method) == '') $countdown_method = 'global'; if($countdown_method == 'global') $ongoing = (isset($settings['hide_time_method']) and trim($settings['hide_time_method']) == 'end') ? true : false; else $ongoing = ($countdown_method == 'end') ? true : false; $disable_for_ongoing = (isset($settings['countdown_disable_for_ongoing_events']) and $settings['countdown_disable_for_ongoing_events']); if($d3 < $d2) { echo '