Elementor Archive Posts with Advanced Sorting
add_action( 'pre_get_posts', function ( $query ) {
// Only modify the query we want
if ( ! $query->is_main_query() || ! $query->is_archive() ) {
return;
}
// set posts per page
$query->set( 'posts_per_page', 3 );
// set order by
$query->set( 'orderby', 'title' );
// set order
$query->set( 'order', 'DESC' );
} );