Chris Geelhoed took a different approach than I did, passing data to a functio then using a require statement for a template file that expects global variables you set right before the require. If you’re into the idea of using Twig as a PHP templating engine on your WordPress site, check out Timber.