Support

Home Forums Event Espresso Premium Query to get upcoming event details in the template

Query to get upcoming event details in the template

Posted: November 9, 2018 at 3:25 pm


sarahschaef

November 9, 2018 at 3:25 pm

I’m trying to customize the upcoming events using a specific layout. I found this code and it works but how do I get the date and time? https://gist.github.com/joshfeck/e3c9540cd4ccc734e755
Thanks


Josh

  • Support Staff

November 9, 2018 at 4:04 pm

You can add something like this within the loop

<?php espresso_next_upcoming_datetime('F j, Y', 'g:i a', $post->ID); ?>

The first two parameters set the date and time formats. If you want to change the date & time formats, you can follow this documentation:

https://codex.wordpress.org/Formatting_Date_and_Time


sarahschaef

November 11, 2018 at 8:51 am

Thanks it worked! but my client asked if it’s possible to have also a photo.. So, can you tell me the code to insert the body text or excerpt and a feature image? That should cover her requests.
Or where do I find all these variables?


sarahschaef

November 11, 2018 at 11:24 am

never mind my last question. I figured out! thanks.


sarahschaef

November 11, 2018 at 12:49 pm

Another request front the client… How do I get the Event End date?


Josh

  • Support Staff

November 12, 2018 at 12:48 pm

You can change the code to display both the start and end date by swapping out espresso_next_upcoming_datetime() and replace with:

<?php espresso_event_date_range(
	$date_format = '',
	$time_format = '',
	$single_date_format = '',
	$single_time_format = '',
	$post->ID
);
?>

The support post ‘Query to get upcoming event details in the template’ 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