Skip to content

Instantly share code, notes, and snippets.

@billerickson
Forked from anonymous/gist:4ee9af8d8502871ec061
Last active February 16, 2016 14:40
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/a045230e5f926e29b3e1 to your computer and use it in GitHub Desktop.
Save billerickson/a045230e5f926e29b3e1 to your computer and use it in GitHub Desktop.
add_action( 'pre_get_posts', 'test_per_dic' );
/**
* Exclude Category from Blog
*
* @author Bill Erickson
* @link http://www.billerickson.net/customize-the-wordpress-query/
* @param object $query data
*
*/
function test_per_dic( $query ) {
if( $query->is_main_query() && ! is_admin() && $query->is_category( 64 )) {
$query->set( 'orderby', 'title' );
$query->set( 'order', 'ASC' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment