La forma más fácil de hacer esto es usar un gancho (el pre_get_posts
hook) para cambiar el orden. ¡Pero debe comprobar que la consulta es una para la que desea modificar el orden! ( is_archive()
o is_post_type_archive()
debería ser suficiente.)
Por ejemplo, ponga lo siguiente en las funciones de su tema.php ...
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;
};