Support

Home Forums Event Espresso Premium Custom Grid View Template – showing past date for event w/ multiple ticket dates

Custom Grid View Template – showing past date for event w/ multiple ticket dates

Posted: July 23, 2018 at 12:22 pm


astiragency

July 23, 2018 at 12:22 pm

I am using a custom grid view template. One of the events I have is a recurring event, with individual tickets available for each session.

In the grid view, it is showing the first ticket date (June 14), when I would like it to be showing the NEXT upcoming date, which could be the 3rd, 4th, etc…

Current template code is:

$datetimes = EEM_Datetime::instance()->get_datetimes_for_event_ordered_by_start_time( $post->ID, $show_expired, false, 1 );

$datetime = end( $datetimes );
if ($datetime instanceof EE_Datetime) {

$startdate = date_i18n( $date_format . ‘ ‘ . $time_format, strtotime( $datetime->start_date_and_time(‘Y-m-d’, ‘H:i:s’) ) );


astiragency

July 23, 2018 at 12:25 pm

edit — I worked through the code and found that $show_expired was not set. I set it to false and it is good.


Josh

  • Support Staff

July 23, 2018 at 12:40 pm

Yep, the second parameter sets whether it uses expired events or current events. You could also use the espresso_next_upcoming_datetime() template tag:

https://github.com/eventespresso/event-espresso-core/blob/master/public/template_tags.php#L593

and that will simplify your template code since the template tag function handles the conditional checks for you.

The support post ‘Custom Grid View Template – showing past date for event w/ multiple ticket dates’ 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