• Hi
    When listing the past events, the elementor widget sorts them according to start-date. When I want to sort them in descending order, it should use the end-date instead. But that can’t anywhere be set. Pls advice.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Support vishali009

    (@vishali009)

    Hi @sir-robin,

    Thanks for reaching out! By default, the Elementor widget sorts past events by start date, but we can modify the query to use the event’s end date for descending order. Update the code in your functions.php file (path for this file: events-widgets-for-elementor-and-the-events-calendar>>includes>>functions.php) Comment the code from line 39 to line 52 and add with the following modification:
    For more, you can refer to this screenshot.

    $orderby = 'event_date';
    if ($meta_date_compare == '<') {
    $orderby = '_EventEndDate';
    }
    $ect_args = apply_filters(
    'ectbe_args_filter',
    array(
    'post_status' => 'publish',
    'posts_per_page' => $settings['ectbe_max_events'],
    'meta_key' => $attribute['key'],
    'orderby' => $orderby,
    'order' => $settings['ectbe_order'],
    'meta_query' => $attribute['meta_date'],
    ),
    $attribute,
    $meta_date_date,
    $meta_date_compare
    );

    This will make sure past events are sorted by their end date in descending order. Let me know if you face any issues with this.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.