Posted: October 14, 2014 at 10:47 pm
|
I’ve been trying to have access to event meta for an event like its venue, number of approved registration, pending registration, unapproved registration for an event in my custom page template within a custom WP_Query loop but as of today I’m unable to get any of the meta from default WordPress get_post_meta() function,hence I looked into the post meta table of the database there were no such event related post metas in the table, so I looked into the plugin files and found that all the variables are protected or private type and cannot be accessed out side of the class so I tried to use public method to access those variable and was able to get some of the fields like ‘Event Time’,’Event Name’,’Event Author’,’Total Tickets Sale’ through the public methods, but some of the public method don’t even return any data without any errors. So if you please kindly guide me through the process of getting those data it will be very helpful to me. I can give you my code if you want to see what am I doing wrong. Thank you in advance. |
Hi, Could you take a look at this resource? http://developer.eventespresso.com/docs/ee-model-objects-and-custom-post-types/ — |
|
|
The link you gave actually didn’t help much because I was already able to pull the metas like Event name date and total attendees but now I still can not get the fields like Venues and approved and unapproved attendees number of an specific event post. So please help me with it. Thank you in advance. |
Hi Ray, We’ve integrated the Kint debugging tool into Event Espresso, so anywhere you want to get a better look at an object (or array, or string, or whatever), you can simply add something like: global $post; d( $post ); into your code, and it will output all kinds of wondrous information. global $post; d( $post->EE_Event ); Notice that in the Kint output (click the + sign to expand the container) there is a tab named “Available Methods” (http://awesomescreenshot.com/00931ch406) ? Example 1: VenuesOne of those methods is global $post; $venues = $post->EE_Event->venues(); will give you an array of any related venues that belong to the event. global $post; if ( $post->EE_Event instanceof EE_Event ) { $venues = $post->EE_Event->venues(); d( $venues ); } Example 2: Number of Tickets SoldAnother one of the methods is EE_Event instanceof EE_Event ) { $tickets_sold = $post->EE_Event->get_number_of_tickets_sold(); echo ' will echo the number of tickets sold for the event. |
|
The support post ‘Getting all the event metas like Location,approved registration etc.’ 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.