I need a suggestion to use a template engine for WordPress theme development. Right now there is no Coding Standard mentioned by WordPress for theme development with template engines. So if I use a template engine, whether WordPress approves it to be uploaded in wordpress.org
I am bit confused between the template engines Laravel’s Blade and Mustache. Which one is better or is there any other better options available? Also for wp blade the WordPress version compatibility is only up to version 3.9.2
as per this link.
UPDATE
If I should not use a template engine, tell me why and I am planning in MVC design pattern. I am planning to use Sprig, does it has any performance improvement?
Something to consider when choosing a WordPress starter theme or framework is the community behind it. I would recommend using Timber (or the Timber Starter Theme) instead of Sprig because it is backed by a much larger community:
Sprig on Github: Last updated in Jan 29. 2 contributors
Timber on Github: Last updated yesterday. 62 contributors
Both options use the Twig templating engine.
Finally, I would caution against holding too tightly to the MVC paradigm for your WordPress theme. WordPress is event driven, providing action and filter hooks at each stage of the page creation process. In other words, it’s more about extending what’s already been provided than developing your own MVC abstractions. Here’s an article on the subject. Good luck!
Well there are many themes which uses template engine the one i remember was WP Realia theme which uses Twig template, and you know it’s really quite amazing and it handle’s it awesomely. I would suggest if you are making bigger wordpress themes then you should use template engines in your theme.
By the way here is a nice article which explains how you can integrate twig template in wordpress
There are lots of alternatives really that provide an alternative to the more traditional templating:
Twig example https://github.com/Rarst/meadow
Timber example http://upstatement.com/timber/
Without need for php coding: Toolset: http://wp-types.com Pods: http://www.pods.io
Using WP purely as a backend: http://sidigital.co/blog/disconnect-your-frontend-from-wordpress http://www.moma.org/explore/inside_out http://raconteur.net/
Using the JSON api you can implement any of the other client-side templating languages easily too.
I wouldn’t necessarily encourage an alternative route like this if the theme is meant to be distributed on .org for example and it’s also worth noting that you can get pretty organized with your templates using get_template_part() and maybe complimenting it with a handy theme-wrapper a la Roots or more powerful template logic found in Hybrid-core.
For what it’s worth, I’ve only come across Blade once in a project I was interested in and I found it quite hard to disect as someone totally unfamiliar with it. So depending on your audience, the methodology needs to be weighed against that kind of thing.
Yes for sure you can use a template engine to develop WordPress theme. WordPress is not having any regulations for such developments, but they always encourage others to go for new things. You can develop your theme using template engines and submit that for approval at library. Surely, if your theme will be having capabilities and will be deserving wordpress.org will approve it and list it into their official library.
As per my views on picking up platform, I will suggest you to go with Mustache. Its having better capabilities.