Posted: May 4, 2020 at 9:15 pm
Hey there. I’m trying to display tickets remaining as part of the excerpt in both the widget and the calendar. I found this: https://eventespresso.com/topic/available-spaces-in-ee4/#post-145670 But I’m finding two issues. #1: It doesn’t actually show a number of tickets remaining. And #2: This shortcode doesn’t work in the widget excerpt. Any tips on making this work? |
|
Hi there, Just to clarify, that code adds a [show_capacity] shortcode so I assume you’ve added that to the content?
What does it show?
Which widget are you referring to? |
|
Hey Tony! I added the code to a custom plugin. Is there somewhere else I should have also added it? I included the shortcode in the event WYSIWYG editor, but it only shows the text from the shortcode (so, in this case, “Remaining Tickets”), not a number of tickets remaining. I tried to use the shortcode in the excerpt, but it doesn’t show anything. You can see the shortcode [show_capacity] from the user side. The widget… I’ve got the Widget Event Espresso Upcoming Events in a sidebar – it’s the one that pulls a list of upcoming events including the excerpt – but that shortcode doesn’t do anything there. (Perhaps there’s a better option – I see there’s an event list shortcode – is there a way to have that shortcode show ONLY the title, date, and excerpt, rather than the entire event details?) |
|
You can only have one instance of a function, so you wouldn’t add code in more than one place and the recommended place to add custom functions is within a custom functions plugin, so no, that’s fine.
Ok, so the shortcode is parsing otherwise the ‘Remaining Tickets’ wouldn’t show. The code will output nothing when the datetimes in the event don’t have a limit set on them, as then the remaining tickets are infinite. Do you have a limit set on the datetime?
It depends what/where the excerpt is being output as EE doesn’t control everything. Where are you check-in the excerpt to see the shortcode?
Ok, so thats the EE Upcoming Events Widget, we’ll come back to this shortly due to this:
You can change the output of the event lists, but it will change both the shortcode and the default event listing shown on /events/ (by default). Go to Event Espresso -> Events -> Templates (tab) On that page is a ‘Event List Pages’ section. You can set what is output on the event lists there. So you could set the ‘Display Description’ option to excerpt and then pretty much all of the other options in that section to no. |
|
Aha! So the datetime WAS the issue (THANK YOU!). That shortcode is working in the main WYSIWYG editor. And I think the workaround for the excerpt will be to modify the template for the Event List. Thank you SO MUCH. |
|
You’re most welcome. Any further questions just let us know. |
|
The support post ‘Show tickets remaining in EE4?’ 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.