Support

Home Forums Event Espresso Premium EE4 – Hide upcoming events on table template

EE4 – Hide upcoming events on table template

Posted: December 31, 2018 at 12:26 pm


Steve Wilder

December 31, 2018 at 12:26 pm

Hello! I have events with tickets set to go on sale at a future date. Currently the table template lists these events the same as other dates, and the guest has to click through to the event detail page before seeing that tickets go on sale in the future. Is there a way to mod the table template so that I can class all events with future ticket sale dates and hide them with CSS? Thanks!


Tony

  • Support Staff

January 2, 2019 at 6:27 am

Hi Steve,

Yes, you can.

You can copy the table template into your themes root directory and make any changes you prefer there (preferably using a child theme if you are not using your own custom theme).

So you would copy \wp-content\plugins\eea-events-table-template\templates\espresso-events-table-template.template.php

Into your themes root directory, and then you could do something like:

if( !$event->tickets_on_sale() ) {
    //The event currently does not have any tickets on sale (based on the sale starts/ends dates of tickets)
    //Check if there are any upcoming tickets on the event.
    $upcoming_ticket = $event->tickets(
        array(
            array(
                'TKT_start_date' => array('>=', \EEM_Ticket::instance()->current_time_for_query('TKT_start_date')),
                'TKT_deleted'  => false,
            ),
            'limit' => 1
        )
    );

    if( !empty($upcoming_ticket) ) {
        //We have an upcoming ticket.
        //Set an event class for upcoming tickets here.
    } else {
        //The event currently does not have active tickets, nor any upcoming.
        //Set an event class for no tickets here
    }
}

Maybe set a variable within the two conditionals and echo that in the table, its up to you.

Is that what you are looking for?


Steve Wilder

January 2, 2019 at 10:57 am

Exactly what I needed, thanks so much!!


Tony

  • Support Staff

January 2, 2019 at 11:45 am

You’re most welcome 🙂

The support post ‘EE4 – Hide upcoming events on table template’ 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