Sorting Events Alphabetically

By default, events will be sorted by their start date. We have occasionally been asked about changing the sort order to be alphabetical by the event title. Good news! This is possible with the following snippet, which you can add to the functions.php file of your child theme:
function tribe_change_event_order( $query ) {
	if ( tribe_is_month() ) {
		$query->set( 'orderby', 'title' );
		$query->set( 'order', 'ASC' );
	}

	return $query;
}
add_filter( 'pre_get_posts', 'tribe_change_event_order', 99 );

If you look at the code closely, you'll notice that this is exclusively for month view. If you would like to change the sort order for other views, you can swap out "tribe_is_month()" with one of the following:

  • List view: tribe_is_list_view()
  • Day view: tribe_is_day()
  • Week view (Pro): tribe_is_week()
  • Map view (Pro): tribe_is_map()
  • Photo view (Pro): tribe_is_photo()

Plugins

The Events Calendar, Events Calendar Pro

Notes

  • Originally written in May 2019
  • Tested with The Events Calendar 4.9.2 and Events Calendar Pro 4.7.2
  • Author: Jennifer

Disclaimer

As with all of our recipes, please note that we share this in the hope it will be useful but without any guarantees or commitments. If you wish to use it, it is your responsibility to test it and adapt it to your needs (or find someone who can do so on your behalf). We are unable to provide further support in relation to this recipe.