Support

Home Forums Event Espresso Premium Event list to show sold out via css?

Event list to show sold out via css?

Posted: August 28, 2019 at 7:27 am


SupercarDriver

August 28, 2019 at 7:27 am

We would like to visually show if an event is sold out via a css class. I can’t see anything to hook into and wondered if there is a way to implement one?


Tony

  • Support Staff

August 28, 2019 at 8:02 am

Hi there,

The my events shortcode already includes a ‘status bar’ that shows the current status of the event: https://monosnap.com/file/8zfc0C5dKOJl7vkGU6jGjJ6Vp35CAB

If I remember correctly your using a custom content-espresso_my_events-event_section.template.php template and if so you can add your own class to the row using that.

The way the template does it now is like this event-status-<?php echo $event->get_active_status(); ?> so you’d just move that to sat the tr element to give the entire row the class.


SupercarDriver

August 28, 2019 at 8:08 am

Sorry, that’s for the backend, we’re using the shortcode for the frontend:
[ESPRESSO_EVENTS_TABLE_TEMPLATE table_pages=35 reg_button_text='View Event']


Tony

  • Support Staff

August 28, 2019 at 8:13 am

My example wasn’t for the backend, but it’s for the front end output using [ESPRESSO_MY_EVENTS] shortcode, which for some reason I had on the brain and I’m not sure why!

Are you loading a custom template for the above output? Meaning do you have a copy of espresso-events-table-template.template.php in your theme’s root directory?


SupercarDriver

August 28, 2019 at 8:20 am

Are you loading a custom template for the above output? Meaning do you have a copy of espresso-events-table-template.template.php in your theme’s root directory?

Yes, got the template in there, no idea what to add to it though


Tony

  • Support Staff

August 28, 2019 at 8:46 am

Pretty much the same as my first reply:

event-status-<?php echo $event->get_active_status(); ?>

So you could change this line:

<tr class="espresso-table-row <?php echo $category_slugs; ?>">

To this:

<tr class="espresso-table-row <?php echo $category_slugs; ?> event-status-<?php echo $event->get_active_status(); ?>">

Now your row has the class .event-status-{status}, is that what you are looking for?


SupercarDriver

August 30, 2019 at 9:17 am

Hi, I added the following:
event-status-<?php echo $event->get_active_status(); ?>"
and it worked, I now have the status output as a class.
It’s showing status-DTU or status-DTS'

From what I can see status-DTU is the sold-out one? If that’s correct then on some events it’s showing incorrectly as I can see this status on event sI know are sold out and on ones that aren’t.


Tony

  • Support Staff

August 30, 2019 at 9:21 am

DTU is datetime upcoming

DTS is datetime sold-out

If your getting events showing upcoming that are sold out can you link me to both the list and the event in question so I can take a look?


SupercarDriver

August 30, 2019 at 9:47 am

Hi Tony, sorry after double checking the events that seemed wrong, they had rogue registrations available on a hidden ticket so it was throwing it out. Got rid of the hidden ticket and all works as expected, thanks.

The support post ‘Event list to show sold out via css?’ 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