Home Forums Event Espresso Premium Add order by to these Query Params

Add order by to these Query Params

Posted: February 26, 2018 at 3:52 pm


February 26, 2018 at 3:52 pm


I’m using this code snippet from your site to show upcoming events after the venue details are output on a venue page but can’t work out how to add a simple order by parameter to this query to get it to show them ordered by start date ASC.

I’ve tried adding ‘order_by’ => ‘Datetime.DTT_EVT_start’, but that threw fatal errors.

Any tips or guidance would be much appreciated thanks 🙂

function ee_list_upcoming_events_for_a_venue( $post ) {
// query the events for this venue using EE_Venue's events() method
$query_params = array(
'status' => 'publish',
'Datetime.DTT_EVT_start' => array(
date( current_time( 'mysql', true ) ),
'Datetime.DTT_EVT_end' => array(
date( current_time( 'mysql', true ) )

$events = EEH_Venue_View::get_venue( $post->ID )->events( $query_params );


  • Support Staff

February 26, 2018 at 4:59 pm

Hi jacl,

I updated the code example so now it includes an order_by clause:


February 27, 2018 at 3:08 am

Hi Josh

So easy when you know how eh 🙂

Great support thank you so much!


The support post ‘Add order by to these Query Params’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: closed

Updated by  jacl 2 weeks, 6 days ago ago

Topic Tags


This topic is:
Do NOT follow this link or you will be banned from the site!