[ad_1]
Hey @no23h,
This is possible with a custom code snippet.
Add this code to your theme’s functions.php file:
add_shortcode('wpsbc-todays-legend', function ($atts, $content = null) {
$events = wpsbc_get_events(array('calendar_id' => $atts['calendar_id'], 'date_day' => current_time('j'), 'date_month' => current_time('n'), 'date_year' => current_time('Y')));
$legends = wpsbc_get_legend_items(array('calendar_id' => $atts['calendar_id']));
if ($events && $events[0]->get('legend_item_id')) {
foreach ($legends as $legend) {
if ($legend->get('id') == $events[0]->get('legend_item_id')) {
$legend_name = $legend->get_name();
}
}
} else {
foreach ($legends as $legend) {
if ($legend->get('is_default')) {
$legend_name = $legend->get_name();
}
}
}
return $legend_name;
});This will create a shortcode called wpsbc-todays-legend
Add it anywhere on your page and pass the calendar ID as a parameter. It will return todays legend item from that calendar.
Eg.:
[wpsbc-todays-legend calendar_id="3"]
