timber / starter-theme

The "_s" for Timber: a dead-simple theme that you can build anything from
MIT License
817 stars 276 forks source link

Timber activation test with 'template_include filter' #33

Closed mgiulio closed 7 years ago

mgiulio commented 7 years ago

Prevents server errors on the front end without adding extra checks in php template files, but hijacking the requested template to a no-timber.php template.

jarednova commented 7 years ago

Hey @mgiulio — thanks for the PR and sorry I'm only getting around to this now. In your opinion what issue or problem does this resolve? I want to make sure this is fixing or improving something (esp. b/c it's adding a new file) rather than simply a "different" way to do something

mgiulio commented 7 years ago

It's not a critical feature, but just a suggestion on how the Timber 'presence' test(that is, checking if the plugin is activated) could be done, especially when a front-end template is rendered. In this way, whatever template would be rendered, if Timber is not installed/actived, the no-timber.php file is rendered instead, without repeating the test in every template, but keeping this code segregated only in function.php

jarednova commented 7 years ago

@mgiulio thanks for that info! You're totally right: this simplifies things so that the error appears on all page variations (single.php, archive.php ...) without actually having to add code to each. I just changed the file organization and merged! Thanks so much!

mgiulio commented 7 years ago

@jarednova I am glad that you found it useful!