Support

Home Forums Event Espresso Premium Display multiple days IF event is more than one day only

Display multiple days IF event is more than one day only

Posted: February 6, 2013 at 11:59 pm


Neal Otto

February 6, 2013 at 11:59 pm

Hi folks. Anyone who can help me?

I have two classes, one has a one day only schedule while the other goes on for 2 days. Is it possible to display just the start date if the event is only for one day, and then display start-end date if the event will go on multiple days?

http://www.jump-start.com/event-registration/

I used the code below: changed < to []

[?php echo event_date_display($start_date, get_option('date_format')) ?] – [?php echo event_date_display($end_date, get_option('date_format')) ?]

This works great on events with multiple days but on one day event listings, it shows like this
(May 01, 2013 – May 01, 2013) which is the same date.

Thanks in advance!


Dean

February 7, 2013 at 3:06 am

Hi Neal,

Im using the latest event espresso 3.1.30.4

The default event_list_display.php shows this at around line 75

<p id="event_date-<?php echo $event_id ?>"><span class="section-title"><?php _e('Date:', 'event_espresso'); ?></span>  <?php echo event_date_display($start_date, get_option('date_format')) ?> 

so that just echoes the date.

What if after that we add this

<?php if($start_date != $end_date) { echo " - " . event_date_display($end_date, get_option('date_format')); } ?>

All this does is check to see if the end date matches the start date, if not echo the end date.

Hope that helps.


Neal Otto

February 7, 2013 at 8:03 pm

Thank you, Dean. It worked perfectly.

http://www.jump-start.com/event-registration/

The support post ‘Display multiple days IF event is more than one day only’ 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