All of your code can be eliminated by using a pre_get_posts
filter:
function marco_custom_category_filter( $query ) {
// only run this on the main query on category archives
if ( is_admin() || ! $query->is_main_query() || ! $query->is_category() ) {
return;
}
$query->set( 'posts_per_page', 2 );
$query->set( 'posts_type', 'readings' );
}
add_action( 'pre_get_posts', 'marco_custom_category_filter' );
With this the main query will be customized, and you will no longer need a second replacement custom query that slows down your page and breaks pagination. A standard normal post loop and normal pagination will now work, e.g.
<?php
get_header();
if ( have_posts()
while ( have_posts() ) {
the_post();
the_title();
}
the_posts_pagination();
}
get_footer();
To customize a category archive, customize the query, do not create a new second query with WP_Query