Use template_before_process hook