Skip to content
This repository has been archived by the owner. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
change post_title to post_date for sort order
  • Loading branch information
jjc16105 committed Aug 30, 2016
1 parent 13721f3 commit 856a89b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions functions.php
@@ -1,12 +1,12 @@
<?php
//
// Order search results by post_title
// Order search results by post_date
//
function my_search_query( $query ) {
// not an admin page and is the main query
if ( !is_admin() && $query->is_main_query() ) {
if ( is_search() ) {
$query->set( 'orderby', 'post_title' );
$query->set( 'orderby', 'post_date' );
$query->set( 'order', 'ASC' );
}
}
Expand Down

0 comments on commit 856a89b

Please sign in to comment.