Support

Home Forums Event Espresso Premium Editing widget display

Editing widget display

Posted: August 15, 2014 at 8:16 am


Chris Zander

August 15, 2014 at 8:16 am

So, I have been editing the display of the events widget and ran into a question or two.
take a look at he footer section of my homepage http://www.periop-ed.com ,

We host two different types of courses, most are two day events, and a few are one day events.

Question is:
Can I format the date so it displays more like “September 6-7, 2014” for two day events, and “September 6, 2014” for the single day events?
Instead of what I am doing now which displays “September 6, 2014 – September 7, 2014”

I guess I’m just asking where the date format is pulled from and can I combine dates into a simpler format?

Thanks
CZ

EE3


Dean

August 18, 2014 at 1:14 am

Hi Chris,

In the following file (which can be copied to the wp-content/uploads/espresso/templates to stop changes when the plugin is updated) is where all the widget code is found: /wp-content/plugins/event-espresso/templates/widget.php

See this Pastebin for the code: http://pastebin.com/ux9LJ7S6

  • This reply was modified 9 years, 8 months ago by  Dean.


Chris Zander

August 18, 2014 at 9:17 am

Dean, That worked like a charm.

Now is there a way to get my single day events to display just the single day? Like an “If-Then” or something? The two day events look perfect but now a single day event displays like “November 27-27 2014”

Beyond my limited coding skills at this point.


Josh

  • Support Staff

August 18, 2014 at 7:13 pm

Hi Chris,

I think this is what you’re looking to do:

start_date == $event->end_date) {
  // normal single day code to display the date goes here
} else {
  // more than one day code to display the dates goes here
}
?>


Chris Zander

August 19, 2014 at 11:06 am

Josh,
How would I integrate that into this bit of code. Sorry I’m a coding idiot. I tried to figure it out myself but BAD thing Happened:)

redacted – Event Espresso support team – LOC


Chris Zander

August 19, 2014 at 11:08 am

Sorry I didn’t even copy and paste the code right, I need a drink.

redacted – Event Espresso support team – LOC


Tony

  • Support Staff

August 19, 2014 at 11:59 am

There’s multiple ways to do this, but here is an example:

  • < a href="< ?php echo $registration_url; ?>">< ?php echo stripslashes_deep($event->event_name) ?>< ?php if ($event->start_date == $event->end_date) { ?>start_date) ?>< ?php } else { ?>start_date) ) ?> - end_date) ) ?>< ?php } ?>
  • Replace line 145 of the widget.php template file with the above. I’ve spaced that out a little so you can follow how it works a little easier.

    That code uses the code @dean provided when the $event->start_date and $event->end_date values don’t match, otherwise it will use the default output.

    • This reply was modified 3 years, 9 months ago by  Seth Shoultes. Reason: Fixed typo

    The support post ‘Editing widget display’ 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