Events Made Easy › Forums › How do I … › Display Event-Image for the actual event
- This topic has 4 replies, 2 voices, and was last updated 9 years, 8 months ago by Anonymous.
-
AuthorPosts
-
Sun 15 Mar 2015 at 14:02 #53728AnonymousInactive
At the homepage I display the next events (most of them are recurrences).
Is it possible to display the event-image that belongs to the topmost event (that is: next event in the list)?
For example:
I have an recurring event called “Shakespeare: A Midummernights Dream”. It has reccurrences on March 20,21,22,23 and 28.
Then I have another recurring event called “Amadeus”. It has recurrences on April 10,11,15,19 and 30.
Both have an image (event-image).
Now I want to show at my homepage the next three events (in my example March 20,21,22) and on top of the list ([eme_events scope=future limit=3 category=1 show_ongoing=0]) I want to display the event-image that belongs to the next event (in the example “Shakespeare”).
If I look at my page on March 27 there should be displayed “March 28, April 10, April 11” and the image for “Shakespare”, because the 28th belongs to this event.
On March 29 should be displayed the event-image that belongs to “Amadeus” and so on.I did not find an shortcode (or am able to write it in the functions.php, because I don’t know enought about the internals) to get this results. As there should be free text between the image and the list of the next events it should be realized by a (new?) shortcode.
How could it be done?
Thanks in advance.
Sun 15 Mar 2015 at 22:50 #53730AnonymousInactiveFound a solution myself:
I created a new shortcode which looks for the next event in the event-table (uses this sql-query from Frankies code:
SELECT * FROM event-table WHERE event_status IN (1,2) AND (event_start_date >= '2015-03-15') AND FIND_IN_SET(1,event_category_ids) ORDER BY event_start_date ASC , event_start_time ASC LIMIT 1
On my page I use category 1 for the events. “2015-03-15” is “today”.
The result gives me all the information I need, including the link to the picture (row: event_image_url) so I can display it on my page.Maybe somebody could find this useful, too.
Sun 15 Mar 2015 at 23:36 #53731FrankyKeymasterIn your case, I would’ve done this to show the image of the first one:
[eme_events limit=1 category=1 show_ongoing=0 template_id=3 template_id_header=7 template_id_footer=9]
Change the template_id_header/footer to a template that’s empty, and template_id to a template only containing #_EVENTIMAGE as content.
That will show you only the event image of the next event.
Then underneath, use your regular shortcode as before:[eme_events limit=1 category=1 show_ongoing=0]
Sun 15 Mar 2015 at 23:39 #53732AnonymousInactiveHi Franky,
thanks for your answer. I’ll try this.
Its much better than my solution, because it will work in the future, even if the structure of dbs will change.Wed 18 Mar 2015 at 23:39 #53803AnonymousInactiveHi Franky,
just want to say that your solutions works perfectly for me.
Thanks again for you fast support and great plugin. -
AuthorPosts
- The forum ‘How do I …’ is closed to new topics and replies.