Add a templating engine like Twig

In the current state templating is plain spaghetti code. PHP interwoven with HTML. Readability is difficult at best. With a solution like Twig things would get dramatically improved. For WordPress already exists a plugin: GitHub - timber/timber: Create WordPress themes with beautiful OOP code and the Twig Template Engine . With its help you get a separation of concerns. You have PHP files responsible for the logic and control and twig files for the presentation. Way easier to read any maintain, improved security through Twig by default, way easier loop construction and in case you ever need to work with time and unix timestamps in WordPress the Twig functionality is nothing but bliss. And the best it is backward compatible. Themes could run built in the old fashioned way without using Twig functionality at all, you could update certain templates adapting to Twig or migrate or write themes from the ground up for Twig.

Read-only archive:

Author: rkoller

Vote count: 11

Status: open


  • difficulty-hard
  • cp-research-plugin
  • request-add-feature


And then why does twig have a for loop?
It’s just a layer (bloat, really) to do the same like php does already

Way easier to read any maintain

It’s not. How is

<?php echo $var ?>

More difficult to understand (even to a non coder) than

{{ var }}


The latter is totally out of context. The word echo instead, even means something, it’s not just a statement in code.

Security is also not improved
If you don’t trust your developer don’t solve the issue by adding bloat but by working with a dev who can be trusted and use code reviews, security measures and so on.

Twig uses eval, a function often disabled and not suggested to be used at all.

I think this petition should be closed as “won’t do”.
Mainly because it adds unnecessary bloat, but for many more reasons (some of which shown above, but the list is quite endless)


Agree, I don’t see a workable path for this to be included in CP core in a way that is secure and not bloated. Setting this to close in a week. Exploring as a plugin is definitely still an option regardless.

1 Like

This topic was automatically closed after 7 days. New replies are no longer allowed.