Support

Home Forums Event Espresso Premium Saving cutomized plugin files from being overwritten

Saving cutomized plugin files from being overwritten

Posted: September 24, 2014 at 8:55 am

Viewing 7 reply threads


Heather Barrow

September 24, 2014 at 8:55 am

I have purchased EE4 and may want to make some customizations to the plugin files. However, I want to make sure any customizations will not be overwritten when the plugin is updated. Can I do this through a hook or filter or can I add a template to the theme folder? I couldn’t find anything specific to this question in the documentation and was hoping someone could lead me in the right direction.

Thanks


Tony

  • Support Staff

September 24, 2014 at 9:53 am

Hi Heather,

Really it depends entirely on what it is that you are trying to modify.

EE4 has many hooks already included which will allow you to modify a lot of the functionality. For styling/template changes we recommend creating a child theme, we have an example within event-espresso-core-reg/public/

Most functions used within EE have hooks spread throughout them to allow you to modify as much as possible. However if a hook is not available we can always create a feature request to include one within a future version of EE.

We highly recommend against modifying core functions, we can not support custom code or customised versions of EE so hooking into EE (with the ability to simply remove the hook to remove the custom code) will make it much easier to troubleshoot should any issues come up.


Heather Barrow

September 24, 2014 at 10:22 am

Here is what I am trying to fix: in the demo site, on an event page, my Event Details were listed first, then Ticket Options, then Upcoming Events and Event Location. However, on my site the ticket options appear first, then upcoming events, then Event details and event location. For some reason only Event location has the title displaying as well. I want to rearrange the order on my site so that Event Details comes first.


Lorenzo Orlando Caum

  • Support Staff

September 24, 2014 at 10:43 am

Hi Heather,

This code snippet will relocate the ticket selector for you:

https://gist.github.com/joshfeck/1151c89082ccb5c0b478

It can be added to a site specific plugin or your child themes functions.php file.

Thanks


Lorenzo


Heather Barrow

September 25, 2014 at 1:44 pm

Thanks Lorenzo, that worked like a charm however, my “upcoming events” datetimes are still showing up first thing. I would like the Event Details, then Ticket Options, then Datetimes (as it is in the demo site). Do you have code I can add that will move the datetime to after the ticket options and before the event location?

You can see what I mean here: http://beta.highriskhope.org/events/sjwh-volunteer-sign/


Lorenzo Orlando Caum

  • Support Staff

September 25, 2014 at 2:43 pm

Hi Heather,

Please replace the existing code with this:

add_filter ('the_content', 'my_remove_event_datetimes', 100 );
 
// remove datetimes
function my_remove_event_datetimes( $content ) {
    if ( 'espresso_events' == get_post_type() && is_singular() ) {
        remove_filter( 'the_content', array( 'EED_Event_Single', 'event_datetimes' ), 110 );
        add_filter( 'the_content', 'my_add_event_datetimes', 122);
    }
    return $content;
}
 
// add datetimes after the tickets
function my_add_event_datetimes( $content ) {
    return $content . EEH_Template::locate_template( 'content-espresso_events-datetimes.php' );
}

add_filter ('the_content', 'my_remove_event_tickets', 100 );
 
// remove tickets
function my_remove_event_tickets( $content ) {
    if ( 'espresso_events' == get_post_type() && is_singular() ) {
        remove_filter( 'the_content', array( 'EED_Event_Single', 'event_tickets' ), 120 );
        add_filter( 'the_content', 'my_add_event_tickets', 121);
    }
    return $content;
}
 
// add tickets after the content
function my_add_event_tickets( $content ) {
    return $content . EEH_Template::locate_template( 'content-espresso_events-tickets.php' );
}


Lorenzo


Lorenzo Orlando Caum

  • Support Staff

September 29, 2014 at 5:07 pm

Hi,

Did this help?


Lorenzo


Heather Barrow

September 30, 2014 at 7:25 am

Worked perfectly, thanks so much Lorenzo. You guys really provide a top notch support forum!

Viewing 7 reply threads

The support post ‘Saving cutomized plugin files from being overwritten’ 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