Support

Home Forums Event Espresso Premium How can I show ticket quantities remaining on other pages

How can I show ticket quantities remaining on other pages

Posted: May 26, 2017 at 3:31 am

Viewing 3 reply threads


wolfpack4417

May 26, 2017 at 3:31 am

I want to advertise “X spots remaining” on my home page for different events. How can I access that data?


Tony

  • Support Staff

May 26, 2017 at 3:50 am

Hi there,

You mentioned you are a developer in another thread so I’ll answer as such.

How are you pulling in the events on the home page? I’m assuming you have the event post from within a custom loop?

If you have an EE_Event object you can use the spaces_remaining_for_sale() method to pull the number spaces, then just use use that to build out your own string.

$event = $post->EE_Event;
if( $event instanceof EE_Event) {
    $spaces_remaining = $event->spaces_remaining_for_sale();
    echo $spaces_remaining . " spaces remaining!";
}


wolfpack4417

May 30, 2017 at 9:29 pm

I’m a back end php dev but don’t have a lot of wordpress experience. I have a theme that has a section where I can add programs so I’ve added a program on the home page that will also have an event in event espresso so I am not actually pulling the events to the front page.

What is $post in the example you posted? And is there API documentation anywhere for this?

Thanks,
Tucker


Tony

  • Support Staff

May 31, 2017 at 4:04 am

What is a ‘program’ and how are you adding an EE event to the front page if you don’t have the event? Manually entering the details?

What is $post in the example you posted?

$post would contain the current ‘post’, usually from within the_loop or your own custom loop. Without knowing how you’re pulling the details in (which apparently you are not?) I can’t really be any more specific.

And is there API documentation anywhere for this?

API for which part?

We have developer documentation available here:

https://github.com/eventespresso/event-espresso-core/tree/master/docs

However, if you don’t have experience with WordPress and using posts you’ll find a lot of it may not make sense.

Viewing 3 reply threads

The support post ‘How can I show ticket quantities remaining on other pages’ 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