Support

Home Forums Event Espresso Premium Customising Upcoming Events Widget

Customising Upcoming Events Widget

Posted: June 7, 2016 at 11:12 am


Nick

June 7, 2016 at 11:12 am

It looks like it’s not possible to customise the Upcoming Events Widget using a template, as all the code is included in EEW_Upcoming_Events.widget.php>. However I am wondering if there is another way of doing so? I would like to include a custom field in the widget and also a custom date format, using the espresso_event_date_obj function.


Lorenzo Orlando Caum

  • Support Staff

June 7, 2016 at 12:28 pm

Hi Nick,

Here is an example of how you can create a custom widget so that your customizations would be preserved on a software update to Event Espresso:

https://eventespresso.com/topic/attempting-to-customize-upcoming-events-widget-no-widget-php-available/#post-102681


Lorenzo


Nick

June 7, 2016 at 3:00 pm

Thanks Lorenzo. I have the custom widget working now. The one change that I am trying to make is to add a custom field. The following works in a template file, but it is not working in the custom widget for some reason:

echo '<h4 class="event-sub-title">'.get_post_meta($post->ID, 'sub_title', true).'</h4>';

The mark up for the h4 tag shows, but with nothing in it. How can I get this working in the widget?


Tony

  • Support Staff

June 7, 2016 at 3:06 pm

It depends where you are using that code, but most likely $post is not an event post but the current post you are viewing.

You’ll likely need to us:

echo '<h4 class="event-sub-title">'.get_post_meta( $event->ID() , 'sub_title', true).'</h4>';


Nick

June 7, 2016 at 3:09 pm

Perfect. Thanks Tony.

The support post ‘Customising 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