Support

Home Forums Event Espresso Premium Event featured image

Event featured image

Posted: July 3, 2014 at 3:10 am

Viewing 9 reply threads


blue level

July 3, 2014 at 3:10 am

is it possible to automaticly add a featured image to a event e.g
a bit of code that says …..

if theres no featured image – display this one – image url


Dean

July 3, 2014 at 4:11 am

Is this for EE3 or EE4?


blue level

July 3, 2014 at 4:16 am

ee3


Dean

July 3, 2014 at 4:35 am

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.


blue level

July 3, 2014 at 5:06 am

i couldent get that to work
i currently have

<code>
//Featured image
	echo apply_filters(&#039;filter_hook_espresso_display_featured_image&#039;, $event_id, !empty($event_meta[&#039;event_thumbnail_url&#039;]) ? $event_meta[&#039;event_thumbnail_url&#039;] : &#039;&#039;);
	if ( !isset($event_meta[&#039;event_thumbnail_url&#039;]) ) { $event_meta[&#039;event_thumbnail_url&#039;] = &quot;http://www.blue-carrots.com/wp-content/uploads/2014/06/course-box.png&quot;; }
</code>


Dean

July 3, 2014 at 6:22 am

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'] : '');


blue level

July 3, 2014 at 7:12 am

ok done
i now get an error

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


blue level

July 3, 2014 at 7:16 am

my //featured image is on line 65 rather than 109


blue level

July 3, 2014 at 7:25 am

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'] : ''
);
  • This reply was modified 10 years, 4 months ago by Tony.


Tony

  • Support Staff

July 3, 2014 at 11:13 am

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.

Viewing 9 reply threads

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.

Event Espresso