Home › Forums › Calendar Products › Events Calendar PRO › Querying Events Calendar with $wpdb
- This topic has 6 replies, 2 voices, and was last updated 9 years, 9 months ago by Casey.
-
AuthorPosts
-
June 13, 2014 at 8:58 am #223358wfaaParticipant
We are building a new website that includes two WP installs (on the same host) – one of which will include The Event Calendar (site A). From the site without The Event Calendar (site B), we want to query site A and grab all upcoming Events in the Event Calendar based on a particular category.
I’ve set up a new wpdb in Site B and I’ve successfully connected to Site A and returned the titles of all posts with a post_type of ‘tribe_events’.
What I’m trying to figure out is what I would write to return upcoming events based on a category (and return the Event Title / Event Date / Event Time / URL to Event).
If the solution to this issue doesn’t include wpdb, let me know.
June 16, 2014 at 6:57 am #229319CaseyParticipantwfaa,
Thanks for getting in touch! Unfortunately, we can’t recommend querying the database directly, as it’s possible that the plugin’s data structure might change in a future version and break your code. Your best bet is to use the tribe_get_events() function to correctly query events in a supported fashion.Take a look at the docs there and hopefully that points you in the right direction. Thanks! ๐
-Casey-
June 16, 2014 at 7:12 am #229370wfaaParticipantThanks, but correct me if I’m wrong – but we won’t be able to use tribe_get_events() from site B since it’s a different WP install. Or you aware of a way that we could do this using tribe_get_events?
June 16, 2014 at 7:15 am #229380CaseyParticipantThanks, but correct me if Iโm wrong โ but we wonโt be able to use tribe_get_events() from site B since itโs a different WP install. Or you aware of a way that we could do this using tribe_get_events?
Unfortunately that’s correct, since you’re trying to query events from a different site, and as such, we wouldn’t be able to provide support for this custom functionality. Our Events are stored in the database as standard Custom Post Types with post meta, so hopefully that points you in the right direction.
Good luck and thanks! ๐
-Casey-
July 20, 2014 at 8:38 pm #466015CaseyParticipantI just wanted to follow up and see if youโre all set here or if you still have further questions. Just let me know if you have further questions or if I should go ahead and close out this thread. Thanks! ๐
-Casey-
July 21, 2014 at 5:50 am #470060wfaaParticipantI was able to make it work with a new wpdb variable and then writing sql statements to query the database. We’ll just have to read the plug-in notes before any upgrades in case the structure does change.
July 21, 2014 at 6:44 am #470537CaseyParticipantAwesome! Thanks for confirming that this got you sorted. Since it looks like you’re all set, I’m going to mark this thread “Answered” and close it out.
By the way, if you have a minute or two, we would love it if you’d write a few words for us here: http://m.tri.be/lo
Thanks in advance. ๐
Cheers,
Casey -
AuthorPosts
- The topic ‘Querying Events Calendar with $wpdb’ is closed to new replies.