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

changes for sort order #1

Merged
merged 3 commits into from Aug 30, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions functions.php
@@ -1,4 +1,17 @@
<?php
//
// 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_date' );
$query->set( 'order', 'DESC' );
}
}
}
add_action( 'pre_get_posts', 'my_search_query' );

function neag_scripts() {
wp_enqueue_style( 'neag-style', get_stylesheet_directory_uri() . '/css/neag.css');
Expand Down