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
fix sort ordering to order by post_title
  • Loading branch information
jjc16105 committed Aug 2, 2016
1 parent bedd847 commit 0618c3e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions functions.php
@@ -1,5 +1,19 @@
<?php

//
// Order search results by post_title
//
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( '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');
wp_enqueue_script('neag-custom', get_stylesheet_directory_uri().'/js/custom.js', array('jquery', 'cs'));
Expand Down

0 comments on commit 0618c3e

Please sign in to comment.