Sugar Calendar, like most other event calendars, stores the event dates as metadata. To sort your results by the event date (meta_key is sc_event_date_time
) use:
[display-posts post_type="event" orderby="meta_value_num" order="ASC"]
That will list every event starting with the oldest to newest.
If you want to list only upcoming events, we’ll need to do a meta query. This specific meta query requires PHP coding as it’s too complicated to implement directly in the shortcode.
This is a great use case for adding shortcut arguments. If post_type=”event”, add all the necessary query parameters.
[display-posts post_type="event']
This code snippet goes in a core functionality plugin or Code Snippets.
Filters used:
display_posts_shortcode_args