Support

Home Forums Event Espresso Premium Get event ID

Get event ID

Posted: March 4, 2016 at 1:44 am


Chingy

March 4, 2016 at 1:44 am

Hi

I am trying to add a ticket selector in two places on my event page template (single-espresso_events.php).

Simply having [ESPRESSO_TICKET_SELECTOR] on the event page doesn’t seem to work, so it looks like I need to set it up as

[ESPRESSO_TICKET_SELECTOR event_id=##]

How can I use php to get the ID for the event please, so that I can insert it into the code above?

The result being, that its a copy of the ticket selector for the same (curent) event page.


Tony

  • Support Staff

March 4, 2016 at 3:06 am

Simply having [ESPRESSO_TICKET_SELECTOR] on the event page doesn’t seem to work, so it looks like I need to set it up as

Which event page?

Do you mean within the event description itself? That should work without the id.

The event_id will be the post id, EE checks if you have a current espresso_events post and will use the id from that without the need to set the id in the shortcode. However it depends where you are using it.

If you within the single-espresso_events.php template file you don’t want to use the shortcode, you can use the espresso_ticket_selector() function.

Take a look within /event-espresso-core/public/Espresso_Arabica_2014/content-espresso_events-tickets.php to see an example of how you can use it within the loop.


Chingy

March 4, 2016 at 6:43 am

Hi

I’m trying to add it within the template. I’ve put it within the if while have posts loop.

I’ve just checked the content-espresso_events-tickets.php file and I saw

<div class="event-tickets" style="clear: both;">
	<?php espresso_ticket_selector( $post ); ?>
</div>

That seems to have worked. I don’t need the full statement do i?


Tony

  • Support Staff

March 4, 2016 at 6:45 am

The full statement as in the additional div?

<?php espresso_ticket_selector( $post ); ?> is used to output the ticket selector.

The div is a wrapper that template uses to style the TS.

The support post ‘Get event ID’ 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