Posted: July 3, 2014 at 3:10 am
|
is it possible to automaticly add a featured image to a event e.g if theres no featured image – display this one – image url |
|
Is this for EE3 or EE4? |
|
ee3 |
|
Well, you could edit the event_list_display.php file, approx line 109, and just below the line where it says //Featured image, add the following if ( !isset($event_meta[‘event_thumbnail_url’]) ) { $event_meta[‘event_thumbnail_url’] = ‘http://www.YOURSITE.dev/wp-content/uploads/2014/05/an_image.jpg’; } The URL should point to the location of the default image you want to use. I would suggest that the image is made at 300×300 pixels or whatever you have set your featured image size to as the code cannot resize the image. You would also need to do a similar thing in the registration_page_display.php file in order to have the default image show there as well. |
|
i couldent get that to work <code> //Featured image echo apply_filters('filter_hook_espresso_display_featured_image', $event_id, !empty($event_meta['event_thumbnail_url']) ? $event_meta['event_thumbnail_url'] : ''); if ( !isset($event_meta['event_thumbnail_url']) ) { $event_meta['event_thumbnail_url'] = "http://www.blue-carrots.com/wp-content/uploads/2014/06/course-box.png"; } </code> |
|
Wrong way around, it should be //Featured image if ( !isset($event_meta['event_thumbnail_url']) ) { $event_meta['event_thumbnail_url'] = "http://www.blue-carrots.com/wp-content/uploads/2014/06/course-box.png"; } echo apply_filters('filter_hook_espresso_display_featured_image', $event_id, !empty($event_meta['event_thumbnail_url']) ? $event_meta['event_thumbnail_url'] : ''); |
|
ok done Parse error: syntax error, unexpected T_STRING in /home/bluecarr/public_html/unpacked/wp-content/plugins/event-espresso/templates/event_list_display.php on line 65 |
|
my //featured image is on line 65 rather than 109 |
|
fixed it //Featured image if ( !isset($event_meta['event_thumbnail_url']) ) { $event_meta['event_thumbnail_url'] = '/wp-content/uploads/2014/06/course-box.png'; } echo apply_filters( 'filter_hook_espresso_display_featured_image', $event_id, !empty($event_meta['event_thumbnail_url']) ? $event_meta['event_thumbnail_url'] : '' );
|
Hi Blue, Thank you for sharing your solution, I cleaned up the formatting from the code highlighter a little so its now easier to read in your post reply. I’ll marks this thread resolved, if you have any further issues please feel free to open another thread. |
|
The support post ‘Event featured image’ 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.