Support

Home Forums Event Espresso Premium How to make featured image work?

How to make featured image work?

Posted: November 15, 2012 at 4:27 pm

Viewing 7 reply threads


Elzette Roelofse

November 15, 2012 at 4:27 pm

I copied over event_list.php and event_list_display.php templates into /wp-content/uploads/espresso/templates.
Then first added:
$event_meta['event_thumbnail_url'];
and then I also tried:
echo do_shortcode('[EE_META type="event_meta" name="event_thumbnail_url"]');
When trying to upload an image from Featured image, neither worked.
How can I make it work to have the featured image option work in the event list?


Josh

  • Support Staff

November 16, 2012 at 4:48 pm

Hi Elzette,

Can you try this?

<img src="<?php echo $event_meta['event_thumbnail_url']?>" />

The above code should go somewhere in the template outside the PHP code blocks, one place could be right after the:

<div class="event-meta">


Elzette Roelofse

November 18, 2012 at 12:15 pm

I’ve tried that, but nothing happens. I add an image through the event’s Featured Image.
When the image is uploaded it only has the option to Insert in Post.
When I select that nothing shows in the area in the admin and neither on the page.
Here is the code for that template file http://pastebin.com/HqYq3VMp. You will notice the code is different to the normal theme file. It is from your Github page that you shared from a different discussion… https://eventespresso.com/topic/more-than-one-course-for-a-event/#post-24833


Josh

  • Support Staff

November 19, 2012 at 3:29 pm

Hi Elzette,

There are a few additional steps that will need to be done in order to get a featured image to display on the Recurring events templates.

Step 1 is to add event_meta to the array near the bottom of event_list.php. Example code follows:

$event_data = array(
                                'event_id' => $event_id,
                                'event_page_id' => $event_page_id,
                                'event_name' => $event_name,
                                'event_desc' => $event_desc,
                                'start_date' => $start_date,
                                'end_date' => $end_date,
                                'reg_limit' => $reg_limit,
                                'registration_url' => $registration_url,
                                'overflow_event_id' => $overflow_event_id,
                                'event_meta' => $event_meta

                            );

Step 2 is to replace what you have now for the featured image display in event_list_display.php with the following:

<img src="<?php echo $first_event_instance['event_meta']['event_thumbnail_url']?>" />

You may also want to add a class to that image or wrap it in a division to help with styling.

If the featured image isn’t updating after uploading an image and after you “Insert to Post”, then there may be a plugin or theme conflict. The above was tested using the latest version of Event Espresso and the twentyeleven theme.


Elzette Roelofse

November 20, 2012 at 12:08 am

Thank you for having a look into this, but it is still not working.
It is generating the following in my source code:
img src – you can view it here: http://www.testingwebsite.me/event-registration/

Here is the Pastebin link to the event_list.php I have at the moment: http://pastebin.com/LAutwWWx
And Pastebin link to the event_list_display.php: http://pastebin.com/H7fN0Dn5

Any ideas? Thanks!


Elzette Roelofse

November 20, 2012 at 4:00 am

Also, I did use the above files in a fresh local installation using Twenty Eleven theme, with no plugins active, except for Event Espresso and the recurring events add-on and the thumbnail still didn’t show on the events page (or registration page).
It does show up in the admin area.
The other issue is, if you look at those to files (event_list.php and event_list_display.php) – it has the code from your Github rather. I did ask in the previous discussion if there is a way to get the ‘spaces available’ and price back in the event list page. Haven’t had a response. I did respond to that, that I did (try) add some code myself – that discussion here: https://eventespresso.com/topic/more-than-one-course-for-a-event/

As soon as I add a recurring event shows all the prices the same as the last added on – please if you can view here: http://www.testingwebsite.me/event-registration/

What I thought how it should work is to be able to have a page listing all the events and each event to show:

  • Title
  • Image thumbnail
  • Price (option of more than one price)
  • How many spaces left
  • Date to register for – option for more than one date in dropdown

Can you let me know if this is achievable?
Here are the files I have at the moment if you want to test it.
Here is the Pastebin link to the event_list.php I have at the moment: http://pastebin.com/LAutwWWx

And Pastebin link to the event_list_display.php: http://pastebin.com/H7fN0Dn5


Josh

  • Support Staff

November 20, 2012 at 12:31 pm

Hi Elzette,

I took a look at the page that you linked to, and it doesn’t look like the recurring events templates are in use there. The one event that was listed had a registration link that added the event to the cart. So it looks like you’re trying a different set of templates right now.

I’m going to try to address your spec list:

What I thought how it should work is to be able to have a page listing
all the events and each event to show:
Title

Title of the recurring event group is already included in both the stock and recurring events templates.

Image thumbnail

The code I gave you works on my test install. Without seeing a working example, I’m at a loss at to why it’s not working for you. I’ve tested and rested on my test site and the code is working for me. Were these templates copied into /wp-content/uploads/espresso/templates?

Price(option of more than one price)

The event list templates do not display price options, they only can display one price. I would suggest typing a price range into a meta field, and using the [EE_META] shortcode to display the price range. See this section of the shortcode documentation for more info:
https://eventespresso.com/wiki/shortcodes-template-variables/#ee-meta
Alternatively, a price range could be placed in the event description, followed by the more tag so the entire description does not display on the event list.

How many spaces left
I would recommend placing this next to each date in the date dropdown, since each date will have a different number of available seats as people register.
Code example:

echo '&nbsp;Available spaces:&nbsp';
 echo get_number_of_attendees_reg_limit($e['event_id'], 'available_spaces');

context in this gist:
https://gist.github.com/4120424

Date to register for – option for more than one date in dropdown

I think we have this covered with the recurring events templates, unless you’re referring to something else.


Elzette Roelofse

November 21, 2012 at 1:25 am

Thank you for your response. The reason why it showed different when you had a look at that page, is because I started using a different plugin. I realised that there are too many points unresolved and I struggle to customise the templates to the way I need it to display. After over a week of back and forth and pressure and stress from my client, I did research into something else and yesterday I was able to set it up, work and display to my needs.
Which also means I have uninstalled this plugin and have no need for the license anymore…

Viewing 7 reply threads

The support post ‘How to make featured image work?’ 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