Support

Home Forums Event Espresso Premium Add end date to Upcoming Events widget

Add end date to Upcoming Events widget

Posted: June 10, 2014 at 12:06 pm

Viewing 5 reply threads


Bob Godnik

June 10, 2014 at 12:06 pm

Can you please let me know how I can add the end date after the start date in the Upcoming Events widget? Most of my seminars are multi-day.

Thanks.


Dean

June 11, 2014 at 1:42 am

Hi Bob,

Generally this would need to be via a code edit as their isn’t an option for it. What version of EE are you using?


Bob Godnik

June 11, 2014 at 10:06 am

Version 3.1.36.5.P

I figured I had to alter some code in the widget php file but didn’t know what code to add.


Josh

  • Support Staff

June 11, 2014 at 4:26 pm

Hi Bob,

You add: $all_meta['end_date']

For example if you want the dates to display as you’d change the date part of line 130 of /templates/widget.php to be:

<span class="widget-event-date"><?php echo event_date_display($event->start_date) . ' - ' . $all_meta['end_date'] ?></span>


Bob Godnik

June 11, 2014 at 5:53 pm

Thank you Josh, that worked. Now that the end date appears, it looks like “July 12, 2014 – July 13, 2014” and having the year appear for the start date looks a little odd.

Is there a way to change the start date format to exclude the year without effecting the date format throughout the rest of the plugin? So the widget would display “July 12 – 14, 2014”.


Josh

  • Support Staff

June 11, 2014 at 6:26 pm

Hi Bob,

It turns out there is because the event_date_display function takes a date format as a second parameter.

Example code follows:

<span class="widget-event-date"><?php echo event_date_display($event->start_date, 'F j') . ' - ' . $all_meta['end_date'] ?></span>

The above example code will display the dates as June 18 – June 19, 2014. This might be better if any of your events happen to span two months. If you want to go further and customize the second date so the month is removed, you’ll need to tear into the line of code (95)that sets the date end variable:

'end_date' => event_date_display($event->end_date, get_option('date_format'))

could be changed to:

'end_date' => event_date_display($event->end_date, 'j, Y' )


Bob Godnik

June 11, 2014 at 6:37 pm

PERFECT! Thank you!

Viewing 5 reply threads

The support post ‘Add end date to Upcoming Events widget’ 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