prefix . 'communievents_events'; $limit = 10; $tz = new DateTimeZone(CommuniApi::TIMEZONE); $now_dt = new DateTime('now', $tz); $list = $wpdb->get_results($wpdb->prepare("SELECT * FROM $table_name WHERE %s < end AND official=1 ORDER BY start LIMIT %d", $now_dt->format('Y-m-d H:i:s'), $limit)); if ($list) { $out .= ''; foreach ($list as $event) { $start_dt = new DateTime($event->start, $tz); $out .= ''; $out .= '
' . $wp_locale->get_weekday_abbrev($wp_locale->get_weekday($start_dt->format('w'))) . ', '; $out .= '' . $start_dt->format('j.') . $wp_locale->get_month_abbrev($wp_locale->get_month($start_dt->format('m'))); $out .= '' . ($event->allday ? '' : $start_dt->format( 'G:i' )); $out .= '
'; } return $out; } function communievents_setup_event_list() { add_shortcode('communievents-event-list', 'communievents_event_list'); }