Support

Home Forums Event Espresso Premium Attempting to customize upcoming events widget. No widget.php available?

Attempting to customize upcoming events widget. No widget.php available?

Posted: June 17, 2014 at 5:53 pm


louisianapipeliners

June 17, 2014 at 5:53 pm

Hi. I want to customize my widgets.php template’s layout. I am attempting to follow the how-to guide here: http://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.

Can anyone provide some direction on this?


Dean

June 18, 2014 at 3:12 am

Hi Eddie,

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.


Josh

  • Support Staff

June 18, 2014 at 9:50 am

Hi Eddie,

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.

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.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: closed

Updated by  Josh 5 years, 5 months ago ago

Topic Tags

Notifications

This topic is: not resolved
Do NOT follow this link or you will be banned from the site!
[for="input_96_5_3"]
[for="input_96_5_3"]
[gravityform id=96 title=false description=false]
  • This field is for validation purposes and should be left unchanged.
[i]
[i]
[gravityform id=69 title=false description=false]
  • This field is for validation purposes and should be left unchanged.