Posted: December 8, 2015 at 12:18 pm
is there an easy way to determine how many tickets are left on a specific event? I need to unhide a div section when the event is sold out or there are no more tickets available. |
|
Hi Shon, One way is use the espresso_event_status() template tag. It will return the status of the event, so if it’s sold out, you can run the code to display the div. |
|
Thanks Josh, However a little new to wordpress. I have a custom template for the page I want this to apply to, however, need a little help on the syntax to get the status. Thanks again for your help. |
|
Hi Shon, Can you post the template code you are working with in a gist or pastebin, and link to it here so we can take a look? |
|
Hi Josh, THanks, |
|
Hi Shon, You’re gonna have a better time with something like this instead:
|
|
Hi Josh, |
|
Are you using the page template on an event custom post type, or is this a regular WordPress page with a shortcode on it or something? What you could do is rename your template file to single-espresso_event.php and then click the View event button from the event editor. This way you’ll be viewing the event custom post type post. |
|
Yes I am using an wordpress page with a shortcode on it. I am guessing that is my problem. Does the code need to change if I am using a wordpress page? |
|
Yes because you’re not viewing an event when it’s just a shortcode on a page. The simple way to fix this is use the event custom post type view instead of a WordPress page with a shortcode. Or you can add the ID of the event to the code like this:
|
|
Hi Josh, |
|
You’re welcome Shon. |
|
The support post ‘Unhide a div section when all tickets are sold’ 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.