Posted: July 8, 2015 at 9:46 am
|
Hello – I would like the date and time range to display as: in the Upcoming Event Widget instead of how it is currently displaying: Could you please advise how to do this? Thank you. |
Hi Kirstin, this will require some custom coding and we can provide you with some information on getting started. The first thing that you’ll need to do is create a custom widget to handle these edits. Please take a look at these steps: Then if you are comfortable making those changes, then please go ahead and do so and reply here so we can share additional information on adjusting the date time display. — |
|
|
Lorenzo, I have the widget created and have edited the .php as instructed. I am uncertain how to register and load the widget. Where does this code go? // Register and load the widget Thank you, |
Hi, that would go into your into your child theme’s functions.php file or via a site specific plugin. — |
|
|
Lorenzo – I added the code to a site specific plugin. I received the following error: Fatal error: Class ‘the_custom_EEW_Upcoming_Events’ not found in /home/content/p3pnexwpnas04_data02/48/2385748/html/wp-includes/widgets.php on line 560 Thank you. |
|
Did you add the Class code as well? The error states the Class is missing.
|
|
Okay, the plugin is created and registered. Please let me know next steps to alter the date and time. Thank you. |
|
I appreciate any help you can provide in completing this widget to change the way the date/time is displayed in my custom widget. Thank you |
I can advise a different approach than what Lorenzo earlier suggested when he said to create a new widget. Creating a new widget is unnecessary if all you’re doing is changing the format of how the date and time ranges are displayed. This is because the espresso_event_date_range() function is pluggable and can load from your custom plugin (tip: make sure your plugin loads before Event Espresso does by naming it starting with the letters a-eu). To make your own custom date range function, you go in and copy the espresso_event_date_range() function from Event Espresso’s /public/template_tags.php file, into your own plugin. Then, you change the last few lines of that function just like the way it’s changed in this example: |
|
|
Do I have to copy the complete contents of the templates_tags.php file into the custom plugin or can I simple add the revised function? |
|
I got it working. Thanks so much! Awesome and quick support, as always! |
|
Hi Kirstin, Glad you got it working! I’ll mark this as resolved, if you have further queries on this topic please open a new thread and link to this one. |
Hi Kirsten, You only copy the one function that you customize, you do not copy the entire file. |
|
The support post ‘Date/Time Range in Upcoming Event 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.