Support

Home Forums Event Espresso Premium Changing event list formatting in EE widget

Changing event list formatting in EE widget

Posted: February 5, 2016 at 7:10 pm


Amanda

February 5, 2016 at 7:10 pm

Hi,
I need to add formatting to the excerpt that comes up in my event list in the event widget. My html is stripped out, so I can’t format that way. I’d also like to omit the times from the date range that is displayed.

What’s the best way to do these things?

Thanks,
Amanda


Tony

  • Support Staff

February 8, 2016 at 6:46 am

Hi Amanda,

The EE Upcoming events widget is a standard WP Widget so you can clone the original into a Site Specific Plugin to create your own copy, rename the widget to something custom and alter the output to suit.

Here is an example when I previously did just that:

https://gist.github.com/Pebblo/d0d5f485ae0599e56e20

So then within that custom widget you can alter the output all you need and continue to update Event Espresso without a problem.


Amanda

February 12, 2016 at 1:13 pm

thanks, I’ll try that.


Amanda

February 14, 2016 at 8:33 pm

As far as I can tell, the html tags are stripped out well before the widget–when the event listing is saved. Do you know where that code is?

If I can’t find a way to get basic formatting into the event excerpt (<p>, <br>) EE will not be much use for me.


Tony

  • Support Staff

February 15, 2016 at 9:32 am

Are you manually adding a excerpt to the event or having Event Espresso create an excerpt automatically for you within the widget?


Josh

  • Support Staff

February 15, 2016 at 9:35 am

Hi Amanda,
There is an open ticket to fix the tags issue for the excerpt field, but in the meantime you need a way to get basic formatting into the event excerpt.

One way you can get basic formatting into the event excerpt right now is use a plugin like Advanced Custom Fields. If you’ve used ACF before, you’ll know that it makes it fairly easy to add your own custom fields to WP posts and pages. It also allows for adding custom fields to Events. So for example you can create a text box editor field and call it

my_event_excerpt.

Once you have your custom field set up, you open up the custom widget plugin that Tony recommended in an editor, and change this line of code to use your custom field:

$desc = $event->short_description( 25 );

you change it to use Advanced Custom Field’s function instead:

$desc = the_field( "my_event_excerpt", $event->ID() );

Then part 2, where you want to remove the times from display. One way to do that is you set the $time variables to have an empty string like this:

$time_format = ' ';
$single_time_format = ' ';

Or another way, if you’re not using a custom widget template, you can use these filters to pass an empty string in a little function:

FHEE__espresso_event_date_range__single_time_format
FHEE__espresso_event_date_range__time_format


Amanda

February 15, 2016 at 10:55 am

@Tony–I’m manually adding an excerpt to the event.

@Josh–okay I’ll give that a try, I’ll keep you posted.


Amanda

February 21, 2016 at 1:41 pm

Advanced Custom Fields works, and I can just put the dates without the times in that field also, so it’s a viable solution.

Thanks,
Amanda

The support post ‘Changing event list formatting in EE 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