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 ,

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?




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:

  • This reply was modified 6 years, 1 month 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.


  • 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

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


  • 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 2 months, 3 weeks ago by  Seth Shoultes. Reason: Fixed typo

    You must be logged in to reply to this support post. Sign In or Register for an Account

    Support forum for Event Espresso 3 and Event Espresso 4.
    Documentation for EE3 and EE4
    Documentation for Event Espresso 3 Documentation for Event Espresso 4

    Status: publish

    Updated by  Tony 6 years, 1 month ago ago

    Topic Tags


    This topic is: not resolved
    Do NOT follow this link or you will be banned from the site!