Areon Hi, thank you for your question.
I used Twig in the past with the Timber plugin, but I don't do that anymore, and here's why.
The only PRO of using Twig in WordPress is being able to use the syntax of that templating syntax.
Other than that, there are no real benefits in using it and unfortunately, I found many CONS the more I used it.
These are all the CONS I can remember:
- You need to have 2 files for every section, one PHP file read by WP to handle variables and post loops, and the Twig file to render.
- Dealing with async template loading was a nightmare due to the synchronous nature of the Twig template.
- It was hard to keep the file structure organized when dealing with multiple template parts. The Theme folder turned into a convoluted mess pretty quickly.
- Some advanced methods weren't fully covered by the Twig docs and I had to dig a lot to find solutions.
I'm not sure if the project is still actively developed or maintained, and if things got better with time.
I'm actually trying to implement the Blade template engine into my AWPS starter theme, but I want to find an automated way to load it without the necessity of manually wire every template file to a regular PHP readable by WordPress.