Support

Home Forums Event Espresso Premium Setting override template location

Setting override template location

Posted: February 27, 2024 at 6:49 pm

Viewing 1 reply thread


tneumann

February 27, 2024 at 6:49 pm

I am working on a site that is using Oxygenbuilder, which does not use a theme, so there is no theme folder. Woocommerce has a method that allows us to set the path location(see link). Is it possible to do something similar with Event Espresso?

https://oxygenbuilder.com/documentation/woocommerce-integration/woocommerce-template-overrides/


Tony

  • Support Staff

February 28, 2024 at 2:45 am

Hi there,

EE runs the template through EEH_Template::locate_template() to find locations of custom templates, that method has a few filters within it to do what you are looking for.

For example you can use FHEE__EEH_Template__locate_template__template_folder_paths to hook in and filter the directories EE will check for custom templates.

Or there is also FHEE__EEH_Template__locate_template__full_template_paths which filters the full path for a template before it is displayed, again that can also do the above.

Here is an example of using the above to add another directory to file paths:
https://gist.github.com/Pebblo/62749ca6a3951e860c474d6d206300a9

(Note the above is using the theme {theme}/espresso/ rather than just the themes root directory but the method is the same you just use whichever path you prefer)

However, not that EE already checks multiple locations for template files, it checks (in this order) these directories:


*        <server path up to>/wp-content/themes/<current active WordPress theme>/
*        <assumed full absolute server path>
*        <server path up to>/wp-content/uploads/espresso/templates/<current EE theme>/
*        <server path up to>/wp-content/uploads/espresso/templates/
*        <server path up to>/wp-content/plugins/<EE4 folder>/public/<current EE theme>/
*        <server path up to>/wp-content/plugins/<EE4 folder>/core/templates/<current EE theme>/
*        <server path up to>/wp-content/plugins/<EE4 folder>/

So you could use /wp-content/uploads/espresso/templates/ to load your templates from. We deprecated usage of those directories a while back due to some security plugins scanning /wp-content/uploads for .php files and either deleting them or emptying the content of the file and leaving it in place (which is worse than deleting it!).

Viewing 1 reply thread

The support post ‘Setting override template location’ 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