Events Manager gives you a special placeholder that you can put into its templates, for inserting the event’s “featured image” into lists and single event pages. If you want to insert a thumbnail, it uses the timthumb script to create one on the fly — but it crops that thumbnail. Here’s how to use the WordPress uncropped thumbnail (or any registered image size).
We create a new custom placeholder that can be used instead of theĀ #_EVENTIMAGE{x,y} placeholder. This is how it will look in the event list format:
{has_image}#_CUSTOMEVENTIMAGETHUMB{/has_image}
And here’s the code. Drop this into a plugin, or your theme’s functions.php file.
<?php
add_filter('em_event_output_placeholder', 'filterEventThumbnail', 10, 3);
/**
* get event image as regular WordPress thumbnail
* (or any registered WordPress image size)
* @param string $result
* @param EM_Event $EM_Event
* @param string $placeholder
* @return string
*/
function filterEventThumbnail($result, $EM_Event, $placeholder) {
if ($placeholder == '#_CUSTOMEVENTIMAGETHUMB') {
$imageID = get_post_thumbnail_id($EM_Event->post_id);
if ($imageID) {
$result = wp_get_attachment_image($imageID, 'thumbnail');
}
}
return $result;
}
And job is done, edges included.