You should never create your own custom WP_Query
queries on category templates (or any other archive template) and use them as main loop.
Why? Because it will break pagination. WordPress will still create all pagination links for such archives based on default query.
So if you want to modify the query in such way, that is should get all posts ordered by date, then you should use pre_get_posts
action (add this to functions.php
file):
function show_all_posts_on_category_archives( $query ) {
if ( ! is_admin() && is_category() && $query->is_main_query() ) {
$query->set( 'posts_per_page', -1 );
$query->set( 'orderby', 'date' ); // you shouldn't need this one - date is default value
}
}
add_action( 'pre_get_posts', 'show_all_posts_on_category_archives' );
And after using that code you can use typical loop in your template file:
while ( have_posts() ) : the_post();
...
endwhile;