Home › Forums › Calendar Products › Events Calendar PRO › build array of events with venue province and organizer name
- This topic has 3 replies, 2 voices, and was last updated 8 years, 9 months ago by Brian.
-
AuthorPosts
-
August 11, 2015 at 11:49 am #995202ScottParticipant
I would like to make a grid view of events and have it grouped by state/province. The data to display would included info from event, venue and orgainzer post type.
my strategy was to build an array and then format the output.
I can pursue a custom sql query but it can get complicated pretty quick having to navigate all the post types and their associate postmeta data.
Can I use a tribe function to collect data for upcoming events that collect data from all three post types?
August 11, 2015 at 5:09 pm #995274BrianKeymasterHi,
Thanks for using our plugins. I can help out here.
I am limited in supporting customizations so I may not be able to help troubleshoot this all the way.
I looked at our coding and we do not have a place where we query all three custom post types together.
It is always done one custom post type and then we use functions to grab information from the other two.
What about creating a custom taxonomy instead and using that to query and order the events?
Also, here is a list of our custom fields and some functions to get venue and organizer ids per events:
https://gist.github.com/jesseeproductions/c2df90a56827dae990a0
Let me know if you have any follow up questions.
Thanks
August 12, 2015 at 6:14 pm #995598ScottParticipantI did it the old fashioned way, sql. Here is my select statement incase if proves helpful to others.
SELECT wp_posts.ID AS id , wp_posts.post_type AS post_type , wp_posts.post_title AS _EventTitle , (SELECT (e.meta_value) FROM wp_postmeta AS e WHERE e.post_id = wp_posts.ID AND e.meta_key = '_EventStartDate') AS _EventStartDate , (SELECT (e.meta_value) FROM wp_postmeta AS e WHERE e.post_id = wp_posts.ID AND e.meta_key = '_EventVenueID') , (SELECT (v.meta_value) FROM wp_postmeta AS v WHERE v.post_id = (SELECT (e.meta_value) FROM wp_postmeta AS e WHERE e.post_id = wp_posts.ID AND e.meta_key = '_EventVenueID') AND v.meta_key = '_VenueCity') AS _VenueCity , (SELECT (v.meta_value) FROM wp_postmeta AS v WHERE v.post_id = (SELECT (e.meta_value) FROM wp_postmeta AS e WHERE e.post_id = wp_posts.ID AND e.meta_key = '_EventVenueID') AND v.meta_key = '_VenueProvince') AS _VenueProvince FROM manageda_wp977.wp_posts WHERE (wp_posts.post_type LIKE '%tribe_event%') AND (SELECT (e.meta_value) FROM wp_postmeta AS e WHERE e.post_id = wp_posts.ID AND e.meta_key = '_EventStartDate') > '2015-08-10' ORDER BY (SELECT (v.meta_value) FROM wp_postmeta AS v WHERE v.post_id = (SELECT (e.meta_value) FROM wp_postmeta AS e WHERE e.post_id = wp_posts.ID AND e.meta_key = '_EventVenueID') AND v.meta_key = '_VenueProvince') ASC , (SELECT (e.meta_value) FROM wp_postmeta AS e WHERE e.post_id = wp_posts.ID AND e.meta_key = '_EventStartDate') ASC
August 13, 2015 at 7:30 am #995746BrianKeymasterHi,
Thanks for sharing this.
Sometimes the old fashion way is the only way to go.
I am going to close this ticket, but if you need anything else related to this topic or another please post a new topic on the forum and we can help you out.
Thanks
-
AuthorPosts
- The topic ‘build array of events with venue province and organizer name’ is closed to new replies.