// In order for pagination to work with a custom query, the global posts_per_page
// must be lower or equal than the 'posts_per_page' argument in your query
// this can be set in settings->reading for all post types
// I have chosen to override the setting for news here
// to ensure the pagination cannot be broken if the setting gets changed
add_action( 'pre_get_posts', 'set_posts_per_page' );
function set_posts_per_page( $query ) {
global $wp_the_query;
// note: in this scenario the query is running in archive.php
if ( ( ! is_admin() ) && ( $query === $wp_the_query ) && ( $query->is_archive() ) && is_post_type_archive( 'news' ) ){
$query->set( 'posts_per_page', 1 );
}
return $query;
}