]*>))/s’, $text, $matches );
// Return the matched text
return $matches[0] . ‘…’;
}
// Here we utilize the hook variables to get our event, find the image, and echo the thumbnail.
function my_action_add_event_featured_image( $file, $name, $template ) {
// Get the event for reference – we’ll need it.
$event = $template->get(‘event’);
$post_content = get_post_field( ‘post_content’, $event );
// Use regex to find content inside all spans with class ‘box-content’
preg_match_all(‘/
// Check if there are matches
if (!empty($matches[1])) {
// Combine all matches into a single string
$box_content = implode(”, $matches[1]);
} else {
$box_content = ”; // Set default value if no matches found
}
$link = sprintf(
‘
‘,
get_post_permalink( $event ),
get_the_post_thumbnail_url( $event ),
get_the_post_thumbnail( $event, ‘large’, array( ‘class’ => ‘alignleft’ ) ),
$box_content // Use box content
);
echo $link;
}
?>