Support

Home Forums Event Espresso Premium Don’t understand how to set up custom template and use the template tags in EE4

Don’t understand how to set up custom template and use the template tags in EE4

Posted: May 14, 2014 at 5:33 am

Viewing 3 reply threads


cambridgejbs

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?

For instance:
On the archive page, how do I get the venue name? How do I get the Ticket name? How do I get the event categories, because espresso_event_categories() doesn’t work? It outputs nothing. I don’t even get an error.

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.


Lorenzo Orlando Caum

  • Support Staff

May 14, 2014 at 12:59 pm

Hello,

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?


Lorenzo


cambridgejbs

May 15, 2014 at 3:40 am

Hi,

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: <?php echo $post->EE_Event->primary_datetime()->start_date_and_time(' ', 'H:i'); ?> and it’d be great if I could use something similar to get the venue name, ticket name and all other information that I need to display.

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
(
    [9281] =&gt; EE_Venue Object
        (
         [_props_n_values_provided_in_constructor:EE_Base_Class:private] =&gt; Array
                (
                    [VNU_name] =&gt; 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( &#039;FHEE__archive_espresso_events_template__upcoming_events_h1&#039;, __( &#039;Upcoming Events&#039;, &#039;event_espresso&#039; ));
do_action( &#039;AHEE__archive_espresso_events_template__before_loop&#039; );
do_action( &#039;AHEE__archive_espresso_events_template__after_loop&#039; ); </code>

Do I need those? If so I’ll just move them into my folder.


Josh

  • Support Staff

May 19, 2014 at 3:27 pm

Hi there,

I have a question for you about this:

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.

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.

Viewing 3 reply threads

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.

Event Espresso