Refactor theme includes to use query functions in query-functions.php to generate the queries.