Order events in main blog loop by post date

Under Events > Settings > General, you can set your events to show alongside your posts in the main blog loop on your site. By default, the events are ordered by the event date. This snippet allows you to change that, so events in the main blog loop are ordered by the date they were published.

To do this, paste the following in your theme's functions.php file. Please note that you may need to clear your cache to see the changes. If you need help using this snippet, feel free to post to our help desk.

In 3.12 and later the snippet will only work correctly if this setting is not checked:

Events > Settings > General Tab > “Recurring event instances”