From eb6e98ba0461c0a8a3a3f878487ed4597410e9fc Mon Sep 17 00:00:00 2001 From: Daniel Nitsikopoulos Date: Mon, 17 Oct 2016 16:45:07 +1100 Subject: [PATCH] Allow sort_by to be set when searching for events --- inc/class-eventbrite-query.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/inc/class-eventbrite-query.php b/inc/class-eventbrite-query.php index 721651c..dfdf6dd 100644 --- a/inc/class-eventbrite-query.php +++ b/inc/class-eventbrite-query.php @@ -153,7 +153,11 @@ protected function set_api_params() { // We need the Eventbrite user ID (or an organizer) if we're getting only public events. if ( ! isset( $this->query_vars['display_private'] ) || true !== $this->query_vars['display_private'] ) { // Set sorting. - $params['sort_by'] = 'date'; + if ( ! empty( $this->query_vars['sort_by'] ) ) { + $params['sort_by'] = $this->query_vars['sort_by']; + } else { + $params['sort_by'] = 'date'; + } // Set the user ID if we don't have a specified organizer. if ( ! empty( $this->query_vars['organizer_id'] ) ) {