Hi Stephen,
This isn’t a bug so much as a request to update the documentation.
Here, the docs say that you can use get_posts
or WP_Query
instead of eo_get_events()
. It’s worth noting that in doing so, you will by default only get events instead of occurrences of events as you do if you’re using eo_get_events()
.
Might be useful to add that, if you want to show occurrences when using WP_Query
, you should add the following arg:
'group_events_by' => '',
Cheers,
Andrew
Andrew Shankie
Hi Andrew,
eo_get_events()
sets some key values to ensure that the query works as expected these are:
'post_type'=> 'event'
'suppress_filters'=>false
It also sets the default value of 'group_events_by'=>''
(which effectively means occurrences). If that isn’t set, then the behaviour is not explicit – it will depend partly on the context and the site options. That is:
- The main query for single events page, admin pages and iCal feeds will group by series
- Otherwise it’s behaviour is set by the options.
I’ll update the documentation just to make it clear that when using the native WordPress query functions the developer is responsible for setting those three attributes.
Stephen Harris
Ah I see – so it would have behaved as I expected had I had the ‘group by occurrences’ site option on. Gotcha.
Thanks!
a.
Andrew Shankie