Skip to content

Instantly share code, notes, and snippets.

@raewrites
Created January 16, 2015 05:59
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 raewrites/309a3da6b3427387bc1e to your computer and use it in GitHub Desktop.
Save raewrites/309a3da6b3427387bc1e to your computer and use it in GitHub Desktop.
Display Alphabetical Order
<?php
function my_function() {
if ( is_category() && $query->is_main_query() ) {
$query->set( 'orderby', 'title');
$query->set( 'order', 'ASC' );
return $query;
}
}
add_action( 'pre_get_posts', 'my_function');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment