fbpx
Did you miss our exclusive webinar on Attendee information? Click here to view the recorded session.
How can we help?

Ordering Events By Event Start Date / meta key

WP Event Manager allows its users to arrange events in order and change the order as per their requirements. In this guide, you will learn about how you can arrange events in order based on their start date/ meta key.

Here are the steps you need to follow to perform the task:

Ordering Events By Event Start Date / meta key

  1. Open your child theme.
  2. Add the following code in the function.php file.
    /** You need to put code in theme functions.php **/
    function theme_name_custom_orderby( $query_args ) {
        $query_args[ 'orderby' ] = 'meta_value'; //orderby will be according to data stored inside the particular meta key
        $query_args[ 'order' ] = 'DESC';
        return $query_args;
    }
    
    add_filter( 'event_manager_get_listings_args', 'theme_name_custom_orderby', 99 );
    
    function theme_name_custom_orderby_query_args( $query_args ) {
        $query_args[ 'meta_key' ] = '_event_start_date'; //here you can change your meta key
        return $query_args;
    }
    
    add_filter( 'get_event_listings_query_args', 'theme_name_custom_orderby_query_args', 99 );
    
  3. You can change your meta key instead of _event_start_date if you want to change the order by any other meta key.
Ordering Events By Event Start Date / Meta Key
Ashok Dudhat

Our team constantly explores ways that technology can help us reinvent industries. We want to change the world by creating great products that transform industries. We Dream It, We Make It.

Quick Links
Close
Close