Querying Events Calendar with $wpdb

Home Forums Calendar Products Events Calendar PRO Querying Events Calendar with $wpdb

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #223358
    wfaa
    Participant

    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’.

    http://pastebin.com/z7rnmsLU

    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.

    #229319
    Casey
    Participant

    wfaa,
    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-

    #229370
    wfaa
    Participant

    Thanks, 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?

    #229380
    Casey
    Participant

    Thanks, 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-

    #466015
    Casey
    Participant

    I 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-

    #470060
    wfaa
    Participant

    I 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.

    #470537
    Casey
    Participant

    Awesome! 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

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Querying Events Calendar with $wpdb’ is closed to new replies.