I have a custom home page that calls post’s thumbnail image. It’s pulling in all of the post’s thumbnails but not the event thumbnails. I have images uploaded in the Featured Image window, but they’re not showing up. My code for the post thumbnails looks like this: the_post_thumbnail(array( 'class' => 'postThumb' )); What code do I need to use to access the event thumbnail? Thanks!
This topic was modified 12 years ago by gwinnettehc. Reason: edited code
Unfortunately the events are separate from the standard post thumbnail so you will need to do a little jiggling to get it to work.
<?php
$post_id = get_the_ID();
$meta_values = get_post_meta($post_id);
$image_url = $meta_values['event_thumbnail_url'][0];
echo $image_url;
?>
What this does is grabs the post ID and then the featured image url held in the post meta. This currently will just echo the url but if you add the variable into an image it can display it
<img src="<?php echo $image_url; ?>" />
This works from within the loop.
Also, with the latest version of Event Espresso (3.1.29.1) we have brought in a new featured image system, that simply needs to be turned on in the Template Settings options, and an image added in the normal way (via featured images box in the event). this is shown in the event list and event registration pages.
One other thing I should add, this requires the Events to have additional posts attached to them (scroll to bottom of the Event Editor and “Create a Post”
Viewing 2 reply threads
The support post ‘Event thumbnail not showing’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.
Support forum for Event Espresso 3 and Event Espresso 4.