When using the main loop instead of the subloop
Description of function.php
function twpp_change_sort_order2( $query ) {
if ( is_admin() || ! $query->is_main_query() ) {
return;
}
if ( $query->is_post_type_archive('yyyy2') ) {
$query->set( 'posts_per_page',1);
$query->set( 'post_type',array('post','yyyy2')); }
}
add_action( 'pre_get_posts', 'twpp_change_sort_order2' );