When to use actions and when to use filters
+1 to both of the other answers, for explaining the primary differences between actions and filters. However, to answer your specific question, about which to use for modifying a query: Injecting your custom query into the template does, as you guessed, require hooking into an existing action. (Whether or not wp_footer is the correct/ideal action … Read more