Support

Home Forums Event Espresso Premium Over-ride javascript files

Over-ride javascript files

Posted: January 4, 2013 at 4:31 am

Viewing 1 reply thread


Will Fairhurst

January 4, 2013 at 4:31 am

I want to modify some of the functions in the ‘plugins/event-espresso/scripts/espresso_cart_functions.js’ file. I have tried adding it to the templates folder but to no effect. I have therefore deregisted the js file in my registration_page.php file and enqueued the new one I have located in a ‘scripts’ folder within ‘uploads/espresso/templates’. The code I used was:

wp_deregister_script('ee_ajax_request', EVENT_ESPRESSO_PLUGINFULLURL . 'scripts/espresso_cart_functions.js', array('jquery')); //Get rid of default js
wp_enqueue_script('ee_ajax_request', EVENT_ESPRESSO_UPLOAD_URL . '/templates/scripts/espresso_cart_functions.js', array('jquery'));

My questions are:

1) Is this best practice for this required modification?

2) Is there anywhere else I should modify to de-register the old script and register mine?

Cheers,

Will


Dean

January 4, 2013 at 7:17 am

Hi Will,

1) I could not find any mention of the script in the file, it is however loaded in the main espresso.php file.

This is a core file and we do not recommend modifying it, any auto updates will over write the changes and it cannot be copied to the uploads folder.

Having the script in the uploads folder is a good idea as it wont get over written on updates.

As an aside if the changes work from the registration_page.php then I would make sure that the registration_page.php is copied to uploads/espresso/templates before modifying so auto updates don’t over write the changes. You will also need to copy over the registration_page_display.php even if you don’t modify it as they are tied together.

Any time you modify a template file a new update may make changes to the original which means you may find issues on update until you compare, contrast and modify the template again. We are trying our best to move as much logic out of the template files so this is minimised/stopped in future releases.

2) The only place I know the file gets enqueued is the espresso.php file.

Viewing 1 reply thread

The support post ‘Over-ride javascript files’ 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