Ordering Events By Event Start Date / meta key

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.
  1. /** You need to put code in theme functions.php **/
  2. function theme_name_custom_orderby( $query_args ) {
  3.     $query_args[ 'orderby' ] = 'meta_value'; //orderby will be according to data stored inside the particular meta key
  4.     $query_args[ 'order' ] = 'DESC';
  5.     return $query_args;
  6. }
  7.  add_filter( 'event_manager_get_listings_args', 'theme_name_custom_orderby', 99 );
  8.  function theme_name_custom_orderby_query_args( $query_args ) {
  9.     $query_args[ 'meta_key' ] = '_event_start_date'; //here you can change your meta key
  10.     return $query_args;
  11. }
  12. add_filter( 'get_event_listings_query_args', 'theme_name_custom_orderby_query_args', 99 );
  1. You can change your meta key instead of _event_start_date if you want to change the order by any other meta key.
    • Related Articles

    • Installation of WP Event Manager

      Automatic Installation of FREE WP Event Manager Installing WP Event Manager is just a matter of a few clicks. You can add WP Event Manager to your website by using the dashboard offered to you at the backend of the CMS. To install the plugin ...
    • Create or pick categories from Free/ Core WP Event manager

      Events are classified into various types based on the kind of visitors they have. Visitors come from different backgrounds. That is why an event organizer or admin must ensure that they make a lot of event categories available to their clients. This ...
    • Event Detail Page

      The Event detail page carries various details of a particular event. These details include the event title, event type, event location, event start date & time, event end date & time, event description, etc. besides this, you can also get the details ...
    • Hide and Add column from the Event Dashboard

      An event dashboard displays all the details related to a specific event. A user can easily access the dashboard after logging into his or her account on WP Event Manager. The event dashboard column can be seen directly in the home page. A user can ...
    • Updating WP Event Manager

      Automatic Update WP Event Manager always strives to achieve perfection in every way and that is why we constantly update our plugins so that you can enjoy their innovative features. Here are the steps that you need to take to update WP Event Manager: ...