Support

Home Forums Event Espresso Premium Creating custom template EE4 table view addon

Creating custom template EE4 table view addon

Posted: October 29, 2014 at 5:51 am


juicecreative

October 29, 2014 at 5:51 am

Hi,

I am trying to add a custom template for the table view. I have followed the (VERY limited) documentation and it states:

“(you can upload custom templates to wp-content/uploads/espresso/templates/)”

(A) This folder doesn’t exist and (B) when I create the folder and then upload a template to it, the template shows nothing in the front end.

What am I doing wrong?

Many thanks

Ben


Tony

  • Support Staff

October 29, 2014 at 6:52 am

Hi Ben,

Can you post the full shortcode you are currently using please?

Are building a custom template from scratch or modifying the original template? If you add your code to pastebin.com and include the link here I will take a look and see if there is any reason for the template to fail.


juicecreative

October 29, 2014 at 9:18 am

Hi Tony,

I have managed to fix it now thanks. I started from scratch but now I am just amending a copy of the original which seems to be working fine.

I would like to add additional information to the table columns like price etc. Where can I find the information on the tags/shortcodes for doing this?

Many thanks

Ben


Lorenzo Orlando Caum

  • Support Staff

October 29, 2014 at 2:05 pm

Hi, I actually missed your second comment about it working. I’m checking with a team member on how to add a featured image so I’ll ask about pricing options as well.

Sorry about that.


Lorenzo


juicecreative

October 30, 2014 at 6:31 am

Thanks Lorenzo,

I would also like to show the number of places available too as well as the price.

Many thanks

Ben


Brent Christensen

  • Support Staff

November 5, 2014 at 10:10 am

Hi Ben,

Here’s some code you can use to get the info you want:

// grab array of EE_Ticket objects for event
$tickets = espresso_event_tickets_available( $post->ID, FALSE, FALSE );
// grab first ticket from array
$ticket = array_shift( $tickets );
$ticket_price = $ticket instanceof EE_Ticket ? $ticket->pretty_price() : '';
$ticket_price_data_value = $ticket instanceof EE_Ticket ? $ticket->price() : '';
// grab primary datetime for event
$first_datetime = espresso_event_date_obj( $post->ID );
$tickets_left = $first_datetime instanceof EE_Datetime ? $first_datetime->tickets_remaining() : 0;
$tickets_left = $tickets_left === INF ? __('unlimited','event_espresso') : $tickets_left;

you will need to add this to the wp-content/plugins/ee4-events-table-template/templates/espresso-events-table-template.template.php file just above where the table rows are printed out around line 100.

EE comes bundled with the Kint debugger class, which can be used to examine any variable. So adding something like:

d( $ticket );

to the above will tell you everything about that EE_Ticket object.
One of the best things about this is it also shows you all of the functions that can be called on that object by clicking on the “Available Methods” tab.

By using that you should be able to learn everything you could possibly do with EE.

The support post ‘Creating custom template EE4 table view addon’ 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.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: closed

Updated by  Brent Christensen 4 years, 8 months ago ago

Topic Tags

Notifications

This topic is: not resolved
Do NOT follow this link or you will be banned from the site!