Posted: 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
|
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. |
|
|
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 |
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. — |
|
|
Thanks Lorenzo, I would also like to show the number of places available too as well as the price. Many thanks Ben |
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. 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 (2)’ 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.