Posted: May 14, 2014 at 5:33 am
On a client’s website we have a customized template for EE3. Now, they want to upgrade to EE4 and maintain the same look. So, I thought I’d just take the old template and add new tags to get the content from EE4 but I’m finding this practically impossible.
Half the tags from this page don’t work, and I find there are so many missing. Where do I get venue name and address on the event page? Where do I get ticket price? How many tickets that are left?
I have created my own versions of the core template files (from the Espresso Arabica folder) and placed them in my theme folder. Is this the right way? And if not, how are you supposed to create custom templates and where are you supposed to place those files?
I do have the full version of EE4, guess I just didn’t create my account properly.
Event Espresso 3 templates unfortunately won’t work with Event Espresso 4 since the software platforms are very different.
With that mentioned, you can custom how your event list page and single event page appears. There are some options in WP-admin –> Event Espresso –> General Settings –> Templates. These will allow you to show or hide certain content.
For customizing your own templates, we do recommend starting with those that are available in the core plugin templates Espresso Arabica theme folder. You can download a copy of these to your computer using an SFTP or FTP client. Then you can upload them to your themes folder and begin editing.
I do want to mention that these files are linked together so if you only added a few, then this could explain why things were not working.
For example, the archive-espresso_events.php file references the loop-espresso_events.php file which in turn references some of the other files.
Is there a link available to your events list page so we can see what you have so far?
Currently, the website is using EE3 and we have custom HTML code in the template that we’ve styled with CSS. So, I would like to maintain that HTML structure in the EE4 template so I don’t have to re-style everything. It’s also much more difficult to style something when you have no control of the HTML structure which I wouldn’t have if I used the default EE4 templates.
What I’ve done is take the espresso archive page template, removed all the code that outputs text from it and added my own HTML code. What I want to do now is for instance to add the venue name to the appropriate place in that code, but it’s practically impossible. What I’ve managed to get is a EE_Venue object, but I can’t get the actual name of the venue.
In one place in my code I used the following to output the time stamp the way I wanted it:
Or, if there’s a way I can extract the information from the objects that would work too. Because I’ve managed to get this object/array:
<code>Array (  => EE_Venue Object ( [_props_n_values_provided_in_constructor:EE_Base_Class:private] => Array ( [VNU_name] => Name of venue </code>
And when I print it out on the screen I can see it has the information I need, but I haven’t been able to get it by looping through it.
Yes, I noticed the files are linked so I have the archive and loop page in the templates folder. The only ones I don’t have are the following from the loop:
<code>echo apply_filters( 'FHEE__archive_espresso_events_template__upcoming_events_h1', __( 'Upcoming Events', 'event_espresso' )); do_action( 'AHEE__archive_espresso_events_template__before_loop' ); do_action( 'AHEE__archive_espresso_events_template__after_loop' ); </code>
Do I need those? If so I’ll just move them into my folder.
I have a question for you about this:
Did the call to loop-espresso_events.php get removed, which is this line that’s normally in archive-espresso_events.php?
<?php get_template_part( 'loop', 'espresso_events' ); ?>
If so, that’s probably why the template tags are not working for you. The template tags need to be added to the loop. If it’s inside the loop you can use the espresso_venue_name() template tag and it will display the name of the venue.
The do_actions that happen before and after the loop are not required, but they do come in handy in you want to dynamically add markup before or after the loop.
The support post ‘Don’t understand how to set up custom template and use the template tags in EE4’ 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.