Updated the pagination method allow passing a custom query object instead of always using the global wp_query object