By default, the Events List Widget in The Events Calendar displays upcoming events in order of their event start date.

But what if you want to sort events by when they were published instead of when they take place? This would allow you to showcase the most recently added events, regardless of their start date.

Fortunately, with a simple code snippet, you can modify the Events List Widget to display events by publication date (newest first) instead.

How to Implement This

The snippet below customizes the widget’s behavior. You can add it as a standalone plugin or insert it into your theme’s functions.php file. Once in place, list widgets will prioritize newly published events instead of upcoming ones.

Targeting Specific Widgets

If you don’t want this change to apply to all List Widgets, you can add constraints to target specific widgets or sidebars.

For example, if you only want this behavior for a widget titled “Newly Added”, modify the following line at the bottom of the snippet:

new EventsListWidget_NewlyAddedEvents();

…to this:

new EventsListWidget_NewlyAddedEvents( array(
  'widget_title' => 'Newly Added'
) );

This ensures that only the “Newly Added” widget adopts the new sorting behavior while others remain unchanged.

Check out the snippet below to implement this feature!