Hey Dryer, check out:
http://ww.wp.xz.cn/plugins/timber-library/
… does exactly what I think you’re looking for. I think if we get usage on a plugin like this we can get momentum on getting ideas like this into core.
fully agree.. we should spread the word about using a good template engine (and Twig is the best, today), and start splitting logic (should go into plugins only) from layouts (themes, Twig or PHP powered)
I’ve written TwigPress, a plugin that allows you to use Twig within your WordPress themes. I’ve used it on a number of production sites
Ok, marketing speel over (sorry about that!)
You can find it here: http://ww.wp.xz.cn/plugins/twigpress/
Please let me know what you think, any questions let me know! I’m keen for templating in WordPress themes to take off as well!
Mike
@mikeshaw217 : Thanks for the link to this!
I wrote the following in the review, but I will echo it here since it might be interesting/relevant to future readers of this thread.
One thing which I immediately changed when I installed this plugin into my website was the location of the Twig installation since I intend to use the composer module manager.
I also modified the path of the “twigs” folder so that it is taken from the root of the website rather than the active theme folder. Agreed, this is counter-intuitive for the needs of most people, but my reasoning will be explained in a moment.
Here is the directory structure which I decided go with:
/httpdocs/blog/wp-content/plugins/twigpress/*
/httpdocs/blog/wp-content/themes/mytheme/*
/httpdocs/vendor/twig/twig/lib/Twig
/httpdocs/twigs
One of the things which I like about using Twig in this way is that it allows me to reuse the same overall site templates outside of WordPress. My website makes use of several separate systems which previously had their own separate themes/templates/skins. Twig allows me to define one master layout which each of these systems can easily share for one consistent look throughout the entire website!
Thanks!!