Support

Home Forums Event Espresso Premium Events Table View Template – Hide upcoming events that are not on sale

Events Table View Template – Hide upcoming events that are not on sale

Posted: March 19, 2018 at 1:28 pm


motio

March 19, 2018 at 1:28 pm

Is it possible to hide upcoming events that are not on sale yet, so the ticket is not open for sale yet, in Events Table View Template by a parameter e.g. show_all_datetimes=false ?


motio

March 19, 2018 at 1:44 pm

Or would it better easier to make a second template with that and use the template-file parameter for that?
[ESPRESSO_EVENTS_TABLE_TEMPLATE template_file=FILE]
In the forum I only found how to add the goes on sale date.


Tony

  • Support Staff

March 20, 2018 at 6:16 am

Hi Motio,

Is it possible to hide upcoming events that are not on sale yet, so the ticket is not open for sale yet, in Events Table View Template by a parameter e.g. show_all_datetimes=false ?

No, we don’t currently have a shortcode parameter available for this.

Or would it better easier to make a second template with that and use the template-file parameter for that?

Yes thats likely the best way to achieve this.

EE Events have a tickets_on_sale() method that will return true if the event has any tickets on sale, you can use that to confirm if the event should be displayed or not.

Note, this isn’t something we have an example of so if you need further help you’ll need to contact a developer and have them build a template for you.


motio

March 28, 2018 at 3:36 am

Thank you Tony for your information. I understand how to add more information to the table but can’t see where to put the check for that method. All that I’ve tried was unsuccessful so I guess have to stay by filtering the table with the event categories.


Tony

  • Support Staff

March 28, 2018 at 3:39 am

I understand how to add more information to the table but can’t see where to put the check for that method.

Do you mean you don’t understand this?

if( $event->tickets_on_sale() ) {
  //Event has tickets on sale, do something here.
}


motio

March 28, 2018 at 4:51 am

This part I actually did understand but couldn’t figure out what should be exactly inside the curly brackets and what shouldn’t.

I put the table row for the event data inside the brackets and now it shows only the events with tickets on sale.


motio

March 28, 2018 at 4:53 am

I would like to show all datetimes (including expired). For the event page I found this solution: https://eventespresso.com/topic/display-expired-event-datetimes/

I’ve noticed that the table view doesn’t show expired datetimes for the events.

I looked into the used method for datetimes “get_datetimes_for_event_ordered_by_start_time” which has the property “include_expired”. Is this for the expired datetimes? I’ve tried set it to true but with no result.


Josh

  • Support Staff

March 28, 2018 at 8:12 am

Hi Thomas,

Here’s another PHP tutorial that may help as you embark on your project:

https://wpshout.com/a-complete-guide-to-object-oriented-php-for-wordpress-developers/

With regards to the usage of get_datetimes_for_event_ordered_by_start_time(), you can override the $show_expired parameter with a boolean value to change its behavior. e.g.
$datetimes = EEM_Datetime::instance()->get_datetimes_for_event_ordered_by_start_time( $post->ID, true, false, $datetime_limit );


motio

March 28, 2018 at 9:22 am

That’s what I’ve tried but I also added some code that probably interfere with that. I’ve tried it on an other template and it worked there. So I have to debug the first template.

The support post ‘Events Table View Template – Hide upcoming events that are not on sale’ 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