Support

Home Forums Event Espresso Premium Can we add ticket selector to Events Table?

Can we add ticket selector to Events Table?

Posted: February 4, 2019 at 11:44 am

Viewing 5 reply threads


scaldwell

February 4, 2019 at 11:44 am

Instead of offering the user a link to the event details page, can there be a ticket selector right there on the table?

Thanks guys!
Shelly


Josh

  • Support Staff

February 4, 2019 at 2:52 pm

Hi Shelly,

You could add that with some custom code (see this code example that shows one way to add the ticket selector)

https://gist.github.com/joshfeck/e8fcb3946f56490d1384bfcc449caa9b

Please note that adding the ticket selector to the events table will have the effect of slowing down that page because the ticket selector needs to query how many tickets are left from the database, which it will be checking for all tickets for all events on that page.


scaldwell

February 5, 2019 at 3:51 pm

I’m not sure if I need to modify that code somehow or just use as-is. I tried it and this is what I’m getting: https://portlandfashioninstitute.com/certificate-programs/credit-class-list-test/

Ideally, that More Info would just open to show the ticket tables from the events detail page. What did I miss?

Thank you Josh!
Shelly


Josh

  • Support Staff

February 5, 2019 at 4:03 pm

You may need to modify the code if you’re not seeing a ticket selector. Here’s the code that adds the ticket selector:

<td>
<?php if ( espresso_display_ticket_selector( $post->ID ) && ( is_single() || ( is_archive() && espresso_display_ticket_selector_in_event_list() ))) :
?>
<div class="event-tickets" style="clear: both;">
	<?php espresso_ticket_selector( $post ); ?>
</div>

<?php endif; ?>
</td>

You could try removing the if() and endif; parts, leaving only:

<td>
<div class="event-tickets" style="clear: both;">
	<?php espresso_ticket_selector( $post ); ?>
</div>
</td>


scaldwell

February 13, 2019 at 8:55 am

Josh,
I thought I’d written another post on this – but now I don’t see it. We’ve got this working – but we want to be able to show all the datetimes on the table and ever since I added the ticket selector, the datetimes have not shown up. Here is our code (I’m sure I’ve deleted something somewhere):

(Moderator note) code is now here:
https://gist.github.com/joshfeck/bdcbb669d455efe8b812d0805b32aea7

And here’s our page: https://portlandfashioninstitute.com/certificate-programs/credit-class-list/
Ideally – the datetimes would existing before the “Details” link. What have I messed up?

  • This reply was modified 5 years, 9 months ago by Josh. Reason: removed large block of code


Josh

  • Support Staff

February 13, 2019 at 9:31 am

Hi Shelly,

It looks like somewhere along the way you copied a template that had all of the datetime information removed.

What you could do is start with the original template:

https://github.com/eventespresso/eea-events-table-template/blob/master/templates/espresso-events-table-template.template.php

Then add the extra table heading around line 50.

Then add:

<td>
<div class="event-tickets" style="clear: both;">
	<?php espresso_ticket_selector( $post ); ?>
</div>
</td>

In the future, please use a GitHub gist or a wpbin (from wpbin.io) to post large blocks of code. We ask this because large blocks of code are unreadable here.

Viewing 5 reply threads

The support post ‘Can we add ticket selector to Events Table?’ 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