Documentation: Show all occurrences when using wp_query/get_posts

WordPress Event Management, Calendars & Registration Forums Report A Bug Documentation: Show all occurrences when using wp_query/get_posts

This topic contains 2 replies, has 2 voices, and was last updated by  Andrew Shankie 9 years, 3 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #18547

    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
    #18552

    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
    #18578

    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
Viewing 3 posts - 1 through 3 (of 3 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.