Support

Home Forums Event Espresso Premium Custom Field Variables: Post ID vs Event ID

Custom Field Variables: Post ID vs Event ID

Posted: September 13, 2012 at 2:49 am

Viewing 2 reply threads


mblatch

September 13, 2012 at 2:49 am

I’m hooking in to action_hook_espresso_display_offsite_payment_gateway in gateway_display.php and I need to fetch the event start date.

I’m looking at https://eventespresso.com/wiki/shortcodes-template-variables/ where it states to use $event_start_date = get_post_meta($post->ID, 'event_start_date', true);

However as I’m on a WP page (EE payment page) I don’t think the $post value is pointing to the correct event. I have the event_id var available, is there an event_id-to-post_id function?

Thanks!


Dean

September 13, 2012 at 3:14 am

Hi,

No I dont believe you can find out the Post ID via the Event info, though you can do it the reverse way as the Post meta holds the Event ID.

If you are on a page (rather than the event post) you would need to supply the appropriate post id to the function in order to get the meta info, as just running get_post_meta without a specific ID will make WP try and find the meta info for that page.


mblatch

September 14, 2012 at 2:23 am

Thanks a lot for your help! That’s a shame, maybe something to add to the API? As I can’t see how to access the event date from the payment page…

Viewing 2 reply threads

The support post ‘Custom Field Variables: Post ID vs 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