I'm using Event Calendar 3. Since there seems to be no easy way of querying all upcoming events as posts, I tried it this way, getting the IDs from the DB and querying the posts from that:
<?php if(!ec3_check_installed(__('Upcoming Events','ec3')))
return;
global $ec3,$wpdb,$wp_version;
$calendar_entries = $wpdb->get_results(
"SELECT
p.id AS id
FROM $ec3->schedule s
LEFT JOIN $wpdb->posts p ON s.post_id=p.id
WHERE p.post_status='publish'
AND end>='$ec3->today' $and_before
ORDER BY start $limit_numposts", OBJECT_K
);
$args = array(
'post_type' => 'post',
'post__in' => $calendar_entries,
'orderby' => 'id',
'order' => 'DESC'
);
$query = new WP_Query( $args );
It doesnt work, obviously because the array looks like this, if I var_dump it:
array(2) {
[37]=> object(stdClass)#2183 (1) {
["id"]=> string(2) "37"
}
[8]=> object(stdClass)#2186 (1) {
["id"]=> string(1) "8"
}
}
How can I use this array for my query?