Do not use query_posts
, and also do not replace the main query with a custom query. This causes more issues than solving the one issue you had before with the main query. I’ve done a complete post on these issues recently that you can check out here
According to your query, the only two things you need to change is posts_per_page
and order
to do this, you can simply use pre_get_posts
to alter the query variables before the main query is executed. You can specifically target only category pages with the conditional tag is_category()
To solve this issue, return to the default loop on your category page. You’ll just need the following on category.php, nothing more.
<?php
if (have_posts()) {
while (have_posts()) {
the_post();
get_template_part( 'content', get_post_format() );
}
}
?>
In your functions.php, use this code with pre_get_posts
to alter the amount of posts per page and how they are ordered on category pages
function wpse_change_category( $query ) {
if ( !is_admin() && $query->is_category() && $query->is_main_query() ) {
$query->set( 'posts_per_page', '1' );
$query->set( 'order','ASC' );
}
}
add_action( 'pre_get_posts', 'wpse_change_category' );