Managed to solve it…
Maybe this will be useful to someone. Here’s my solution.
single-mec-events.php:
<?php
/** no direct access **/
defined('MECEXEC') or die();
?>
<?php get_header(); ?>
<?php
$single = new MEC_skin_single();
$single_event_main = $single->get_event_mec(get_the_ID());
$single_event_obj = $single_event_main[0];
$title = $single_event_obj->data->title;
$thumbnail = $single_event_obj->data->thumbnails['full'];
$content = $single_event_obj->data->content;
// Function to return event data
function get_mec_event_data($key) {
$start_date = get_post_meta(get_the_ID(), 'mec_start_date', true);
$start_hours = get_post_meta(get_the_ID(), 'mec_start_time_hour', true);
$start_minutes = get_post_meta(get_the_ID(), 'mec_start_time_minutes', true);
$start_ampm = get_post_meta(get_the_ID(), 'mec_start_time_ampm', true);
$end_date = get_post_meta(get_the_ID(), 'mec_end_date', true);
$end_hours = get_post_meta(get_the_ID(), 'mec_end_time_hour', true);
$end_minutes = get_post_meta(get_the_ID(), 'mec_end_time_minutes', true);
$end_ampm = get_post_meta(get_the_ID(), 'mec_end_time_ampm', true);
$more_info = get_post_meta(get_the_ID(), 'mec_more_info', true);
$cost = get_post_meta(get_the_ID(), 'mec_cost', true);
$mec_date = get_post_meta(get_the_ID(), 'mec_date', true);
$mec_start_datetime = get_post_meta(get_the_ID(), 'mec_start_datetime', true);
$start_time = format_time($start_hours, $start_minutes, $start_ampm);
$end_time = format_time($end_hours, $end_minutes, $end_ampm);
switch ($key) {
case 'start_date':
return $start_date;
case 'start_time':
return $start_time;
case 'end_time':
return $end_time;
case 'more_info':
return $more_info;
case 'cost':
return $cost;
case 'mec_date':
return $mec_date;
case 'mec_start_datetime':
return $mec_start_datetime;
case 'start_ampm':
return $start_ampm;
case 'end_ampm':
return $end_ampm;
default:
return '';
}
}
// 24 hour conversion
function format_time($hours, $minutes, $ampm) {
$hours = intval($hours);
$minutes = intval($minutes);
if ($ampm === 'PM') {
$hours += 12;
}
$hours = str_pad($hours, 2, '0', STR_PAD_LEFT);
$minutes = str_pad($minutes, 2, '0', STR_PAD_LEFT);
return $hours . ':' . $minutes;
}
echo do_shortcode('[bricks_template id="1363"]');
?>
<?php get_footer(); ?>
Then I can get the correct info in my Bricks template by fx:
Title: {post_title}
Photo: {featured_image}
Content text: {post_content}
Date: {echo:get_mec_event_data(‘start_date’)}
Time: {echo:get_mec_event_data(‘start_time’)} - {echo:get_mec_event_data(‘end_time’)}
Link: {echo:get_mec_event_data(‘more_info’)}
Cost: {echo:get_mec_event_data(‘cost’)}