Hi,
I created a custom feed for the events to run a RSS based campaign at Mailchimp.
It’s something that worked very well with other post types and event plugins.
With EO I get a very strange result.
I use these arguments for my query and it looks like your plugin add some additional filters.
$args = array(
'post_type' => 'event',
'posts_per_page' => 10,
'suppress_filters'=>false,
'meta_query' => array(
array (
'key' => '_eventorganiser_schedule_start_start',
'value' => current_time( 'mysql' ),
'compare' => '>=',
'type' => 'DATETIME'
)
),
);
This is the query:
SELECT SQL_CALC_FOUND_ROWS wp_d946e71125_posts.*, wp_1_eo_events.event_id, wp_1_eo_events.event_id AS occurrence_id, wp_1_eo_events.StartDate, wp_1_eo_events.StartTime, wp_1_eo_events.EndDate, wp_1_eo_events.FinishTime, wp_1_eo_events.event_occurrence FROM wp_d946e71125_posts INNER JOIN wp_d946e71125_postmeta ON ( wp_d946e71125_posts.ID = wp_d946e71125_postmeta.post_id ) LEFT JOIN wp_1_eo_events ON wp_d946e71125_posts.ID = wp_1_eo_events.post_id WHERE 1=1 AND (
( wp_d946e71125_postmeta.meta_key = ‘_eventorganiser_schedule_start_start’ AND CAST(wp_d946e71125_postmeta.meta_value AS DATETIME) >= ‘2017-04-15 21:35:09’ )
) AND wp_d946e71125_posts.post_type = ‘event’ AND (wp_d946e71125_posts.post_status = ‘publish’ OR wp_d946e71125_posts.post_status = ‘confirmed’ OR wp_d946e71125_posts.post_status = ‘private’) AND (wp_1_eo_events.EndDate > ‘2017-04-15’ OR (wp_1_eo_events.EndDate = ‘2017-04-15′ AND wp_1_eo_events.FinishTime > ’21:35:09’)) GROUP BY wp_1_eo_events.event_id ORDER BY wp_1_eo_events.StartDate ASC, wp_1_eo_events.StartTime ASC LIMIT 0, 10
The whole part for endtime etc. shouldn’t be there, right?
Olaf Lederer
You probably have the setting to not show past events enabled, which is what the FinishTime
and EndDate
are doing. If you want to remove that part of the query you can use
'showpastevents' => true,
in your $args
. However, it wouldn’t make any difference to the return result set.
Note that the FinishTime
and EndDate
are returning only future event dates. What you are doing is stronger: returning only event dates of events which have not had an occurrence yet. If you do not have any recurring events, then they are the same thing.
Stephen Harris
HI Stephen,
thanks for the reply. The problem in this query is that the result shows some events multiple time. Check http://maarssen.wordtest.nl/rss-feed-pagina-voor-events/
Is could use a complete custom query to avoid all you filters, but it should work this way too.
Olaf Lederer
By default it will show an entry for each occurrence. You could try 'group_events_by'=>'series'
. This will mean each event will only appear at most once.
Stephen Harris
The “group_events_by” argument has fixed that problem and the orderby “ID” argument provides the newest submissions first.
Thanks I’m happy now 🙂
Olaf Lederer
Orderby post_date
is probably a better choice, but typically IDs and post date will give the same ordering.
Stephen Harris