From 13721f31153d04b9fcabe82c28d30261790a3d3e Mon Sep 17 00:00:00 2001 From: John Calande Date: Wed, 3 Aug 2016 08:57:55 -0400 Subject: [PATCH 1/3] changes for sort order --- functions.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/functions.php b/functions.php index 98651a1..3180aba 100644 --- a/functions.php +++ b/functions.php @@ -1,4 +1,17 @@ is_main_query() ) { + if ( is_search() ) { + $query->set( 'orderby', 'post_title' ); + $query->set( 'order', 'ASC' ); + } + } +} +add_action( 'pre_get_posts', 'my_search_query' ); function neag_scripts() { wp_enqueue_style( 'neag-style', get_stylesheet_directory_uri() . '/css/neag.css'); From 856a89b91beaffbfeaa2c749d1cfd14a66110402 Mon Sep 17 00:00:00 2001 From: John Calande Date: Tue, 30 Aug 2016 10:40:02 -0400 Subject: [PATCH 2/3] change post_title to post_date for sort order --- functions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions.php b/functions.php index 3180aba..b14cd1e 100644 --- a/functions.php +++ b/functions.php @@ -1,12 +1,12 @@ is_main_query() ) { if ( is_search() ) { - $query->set( 'orderby', 'post_title' ); + $query->set( 'orderby', 'post_date' ); $query->set( 'order', 'ASC' ); } } From 38f8386c5c79e05cf52eed039673958099b53895 Mon Sep 17 00:00:00 2001 From: John Calande Date: Tue, 30 Aug 2016 11:19:23 -0400 Subject: [PATCH 3/3] fix search ordering, by post_date --- functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions.php b/functions.php index b14cd1e..f4820e3 100644 --- a/functions.php +++ b/functions.php @@ -7,7 +7,7 @@ function my_search_query( $query ) { if ( !is_admin() && $query->is_main_query() ) { if ( is_search() ) { $query->set( 'orderby', 'post_date' ); - $query->set( 'order', 'ASC' ); + $query->set( 'order', 'DESC' ); } } }