Hi. I want to customize my widgets.php template’s layout. I am attempting to follow the how-to guide here: https://eventespresso.com/wiki/customizing-your-upcoming-events-widget-using-css-and-template-files/#step2. Problem is, I dont have a widgets.php within my wp-content/plugins/event-espresso/templates. I have a directory under /event-espresso-core-reg/ called /widgets/. Within there I have /upcoming_events/EEW_Upcoming_Events.widget.php.
EE4 is structurally very different from EE3, so there is no widgets.php template as such, instead it uses EEW_Upcoming_Events.widget.php.
Right now there isn’t a way to edit this file outside of the core plugin, which means any changes will be lost on update.
I will add a feature request to see if we can add in a way to edit the file via the uploads section or at the very least to add in some more hooks and filters to allow custom functions to edit it.
I cannot say if or when those would be added though.
It turns out you can make edits to the Event Espresso 4 widget. I’ll outline the steps here:
1) Create a site specific plugin, or if you have a WP child theme set up, you can add your custom widget code to the theme’s functions.php file.
2) copy the contents of EEW_Upcoming_Events.widget.php into your custom plugin or the child theme’s functions.php file.
3) change the class name and ID of your widget copy. This is done in the first few lines of code you’ve copied over. An example:
class the_custom_EEW_Upcoming_Events extends WP_Widget {
/**
* Register widget with WordPress.
*/
function __construct() {
parent::__construct(
'custom-ee-upcoming-events-widget',
__( 'Custom Event Espresso Upcoming Events', 'event_espresso' ),
array( 'description' => __( 'A custom widget to display your upcoming events.', 'event_espresso' )),
array(
'width' => 300,
'height' => 350,
'id_base' => 'ee-upcoming-events-widget'
)
);
}
4) then register and load the widget
// Register and load the widget
function my_load_customEE_widget() {
register_widget( 'the_custom_EEW_Upcoming_Events' );
}
add_action( 'widgets_init', 'my_load_customEE_widget' );
5) optionally unregister_widget the stock EE upcoming Events widget so that it doesn’t load on the Widgets admin.
Viewing 2 reply threads
The support post ‘Attempting to customize upcoming events widget. No widget.php available?’ 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.
Support forum for Event Espresso 3 and Event Espresso 4.