I have a wordpress template part called "grid-loop.php" that has a query that shows a grid of items. Initially, in this template part, I pass $args to it. It works fine. I'm trying to set it up differently now. Let me explain.
I now have a page template (page-news.php) that contains the args:
$args = array(
'category_name' => 'news',
Beneath that I have this:
<?php get_template_part( 'grid', 'loop' ); ?>
The grid-loop contains this:
$the_query = new WP_Query( $args );
So basically the $args is in a separate document from the actual WP_Query. It doesn't work. Maybe it can't work this way or I'm doing something wrong? When I put the arguments with the query in the same document, it works fine. Suggestions?