A maneira mais fácil de fazer isso é usar um gancho (o pre_get_posts
hook) para alterar a ordem. Mas você deve verificar se a consulta é aquela para a qual você deseja alterar o pedido! ( is_archive()
ou is_post_type_archive()
deve ser suficiente.
Por exemplo, coloque o seguinte no functions.php do seu tema ...
add_action( 'pre_get_posts', 'my_change_sort_order');
function my_change_sort_order($query){
if(is_archive()):
//If you wanted it for the archive of a custom post type use: is_post_type_archive( $post_type )
//Set the order ASC or DESC
$query->set( 'order', 'ASC' );
//Set the orderby
$query->set( 'orderby', 'title' );
endif;
};