By the time index.php runs, it seems as though there is already a query populated.
How can I find out what that query's query string is?
new WP_Query([query string is here])
Take a look at
and if you have custom loop in your template, dont forget to use (query_post())
Function should be called after The Loop to ensure conditional tags work as expected.