Providing a function to override the default query

If you want to plug into the query, pre_get_posts() is going to be your friend. Pippin Williamson also has a great writeup on the subject.