FacetWP – use pre_get_posts to customize archive query

mgibbs189

{{gist file=”test.php” lang=”php”}}
<?php
// Add to your theme’s functions.php
function modify_archive_query( $query ) {
if ( $query->is_archive() ) {
$query->set( ‘orderby’, ‘title’ );
$query->set( ‘order’, ‘ASC’ );
}
}
add_action( ‘pre_get_posts’, ‘modify_archive_query’ );

{{/gist}}