Support » Plugin: The Events Calendar » Events in event categories are ordered by date DESC

  • Resolved Noëll Taravati

    (@nectar91)


    Normally, when we dive into our archive, the latest items shows up first. E.g.
    December 10
    December 9
    November 30 (and so on…)

    In our site, the opposite happens. Instead of listing older events by date ascending, the items are displayed descending. Here are a couple of details about our blog:
    – The problem occurs when browsing to Events > ‘Previous events’ (front-end)
    – We’re using the latest version of The Events Calendar
    – Our theme is Flatsome, but have tried WordPress default;

    Is there a way to change the order?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hey there,

    Thanks for reaching out 😄

    Can you try this snippet in your functions.php?

    add_filter( 'pre_get_posts', 'tribe_change_event_order', 99 );
    function tribe_change_event_order( $query ) {
    if ( tribe_is_past() || tribe_is_upcoming() || tribe_is_photo() ) {
    $query->set( 'orderby', 'title' );
    $query->set( 'order', 'ASC' );
    }
    return $query;
    }

    Take care,
    Ed 🤟

    Thread Starter Noëll Taravati

    (@nectar91)

    Thank you so much! This has solved our issue.

    I do not understand why you change the ‘orderby’ to ‘title’, but hey; it works. 🙂 Have a merry Christmas!

    Glad that helped!

    Hope you had a Merry Christmas as well!

    Take care,
    Ed 🤟

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Events in event categories are ordered by date DESC’ is closed to new replies.