Is there an action hook that fires just before a template is loaded?
Looking at the Action Reference in the Codex, the first action listed after the wp action that sets up the WP object is template_redirect, which is indeed fired after all queried data is available, and before a template is selected. You can use the WordPress conditionals to determine if your intended template file will be … Read more