Support

Home Forums Event Espresso Premium Best practices for updating the event shortcode

Best practices for updating the event shortcode

Posted: September 15, 2021 at 1:09 pm

Viewing 3 reply threads


Jason Lee

September 15, 2021 at 1:09 pm

Hi there!

We are having a dev team change the way the list of events looks when this shortcode is used: [ESPRESSO_EVENTS category_slug=displaynow limit=100 ].

Is there a best practices we should recommend to them to make sure it’s done in the most efficient way possible and will be fine/not erased when we update the plug in?

I remember something about an uploads folder or a certain template with EE3 but can’t find the documentation for EE4.

Thanks ๐Ÿ™‚


Tony

  • Support Staff

September 16, 2021 at 4:27 am

Hi Jason,

The /uploads/espresso/ in EE3 was the ‘old’ method of doing it, we used that method as EE basically had its own complete template system outside of your themes output (and pretty much outside of WordPress) so we needed a way to allow users to customize the files.

However, using /wp-content/uploads/espresso/ has its own issues and one of those is the fact that some ‘security plugins can detect a PHP file in uploads and simply replace the contents with… nothing. Meaning you then have empty template files loading nothing (so no errors indicating an issue!) on the page and no idea what on earth happened.

With EE4 we went more with ‘the WordPress way’, EE events are custom post types and a lot of the output is controlled by your theme now. We obviously have event content and templates for that content that we use but still a lot of how the event is displayed is controlled by the themes and EE will load files from within your theme.

Now, to answer your question you can load templates from the root directory of your theme when customizing them. You’re developers should take a look at the /event-espresso-core-reg/public/Espresso_Arabica_2014/ template files within EE for an idea on how to set those files up. For the [ESPRESSO_EVENTS] shortcode there is a content-espresso_events-shortcode.php they can copy over to your theme and modify. That template can call other template files, and also the_content() which then injects the event data using their template files.

It depends on the specifics of what you are trying to do on how deep they will need to go here, we have some additional details on the templates here:

https://gist.github.com/lorenzocaum/0a35fe4997992fdb1dc5


Jason Lee

September 20, 2021 at 4:49 pm

Thanks Tony, very helpful (as usual)!


Tony

  • Support Staff

September 21, 2021 at 6:33 am

You’re most welcome ๐Ÿ™‚

Viewing 3 reply threads

The support post ‘Best practices for updating the event shortcode’ 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