The issue with your query is that new WP_Query($query_string,$args);
is not correct syntax, however, creating a new WP_Query
is not the way to do what you want. See the codex page for pre_get_posts
for the correct way to modify the main query.
I assume by setting posts per page to 999, you want to show all posts, so just use -1
instead to remove the limit from the query. This would go in your theme’s functions.php
file:
function wpa90381_category_query( $query ) {
if ( $query->is_category() && $query->is_main_query() ) {
$query->set( 'posts_per_page', -1 );
$query->set( 'orderby', 'name' );
}
}
add_action( 'pre_get_posts', 'wpa90381_category_query' );