Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created August 21, 2013 18:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billerickson/6298213 to your computer and use it in GitHub Desktop.
Save billerickson/6298213 to your computer and use it in GitHub Desktop.
<?php
/**
* Category Query
*
*/
function be_category_query( $query ) {
if( $query->is_main_query() && $query->is_category() && !is_admin() ) {
$query->set( 'orderby', 'title' );
$query->set( 'order', 'ASC' );
}
}
add_action( 'pre_get_posts', 'be_category_query' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment