Support

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


jacl

February 26, 2018 at 3:52 pm

Hi

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
// http://code.eventespresso.com/classes/EE_Venue.html#method_events
$query_params = array(
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 );


Josh

  • Support Staff

February 26, 2018 at 4:59 pm

Hi jacl,

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

https://eventespresso.com/wiki/useful-php-code-snippets/#venue-event-list


jacl

February 27, 2018 at 3:08 am

Hi Josh

So easy when you know how eh 🙂

Great support thank you so much!

Jonathan

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 7 months ago ago

Topic Tags

Notifications

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