Hey @thomasnordic,
You can add the code below to your theme’s functions.php file. It will create a shortcode that you can add on any page to display future bookings. You can also include details such form data by searching for a field’s value.
add_shortcode('wpbs-bookings', function ($atts, $content = null) {
$bookings = wpbs_get_bookings(array('calendar_id' => $atts['calendar_id'], 'orderby' => 'start_date', 'order' => 'asc'));
$output="<div class="wpbs-custom-bookings">";
foreach ($bookings as $booking) {
if (strtotime($booking->get('start_date')) < current_time('timestamp')) {
continue;
}
$fields = $booking->get('fields');
$name = $fields[array_search('155', array_column($fields, 'id'))]['user_value']; // 155 is the form field ID for the "name" field.
$output .= '<div class="wpbs-custom-booking">'
. date('d.m.', strtotime($booking->get('start_date'))) . ' - '
. date('d.m.y', strtotime($booking->get('end_date'))) . ': '
. $name .
'</div>';
}
$output .= '</div>';
return $output;
});