Support

Home Forums Event Espresso Premium Event Start and End Date will not show

Event Start and End Date will not show

Posted: October 2, 2018 at 7:55 am

Viewing 2 reply threads


ardiaful

October 2, 2018 at 7:55 am

I need to show the event start and end date, only when end date is different from start date. I have this code in single-espresso_events.php file:

$Event_View_Start_date = EEH_Event_View::the_event_date($date_format = 'F j, Y', $time_format = ' ',get_the_ID());
                                    $Event_View_End_date = EEH_Event_View::the_event_end_date($date_format = 'F j, Y', $time_format = ' ',get_the_ID());
                                    if($Event_View_Start_date!=$Event_View_End_date)
                                    {
                                        echo $Event_View_Start_date;
                                         echo " - ";
                                        echo $Event_View_End_date;
                                    }
                                    else
                                    {
                                        echo $Event_View_Start_date;
                                       
                                    }

However, this only works fine when the event has only 1 date, and it does not show end date when the event has more than 1 date (old or upcoming). Am I missing something?


ardiaful

October 2, 2018 at 7:56 am

This reply has been marked as private.


Josh

  • Support Staff

October 2, 2018 at 8:09 am

Hi,

What appears to be missing is a loop to loop through all the datetimes of the event. You can instead use the get_all_date_obj() helper method to get all the datetimes, then loop through those to do the comparisons between the start date & end dates.

Viewing 2 reply threads

The support post ‘Event Start and End Date will not show’ 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