Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WordPress theme development - Template Engine [closed]

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?

like image 815
Vishnu Sureshkumar Avatar asked Mar 14 '15 18:03

Vishnu Sureshkumar


People also ask

Does WordPress use templating engine?

WordPress is a natural environment for us to see how templating engines work, not only because it's template-driven, but because of its reliance on PHP.

How do you edit a WordPress template?

You can also edit templates via the Site Editor. Go to Appearance → Editor in your dashboard. You will be taken to the template your homepage uses. To switch to editing a different template, click your site icon in the upper left corner and select Templates.

Where are templates stored in WordPress?

The list of available templates can be found at Pages > Add New > Attributes > Template. Therefore, a WordPress user can choose any page template with a template name, which might not be your intention.

Is PHP a template engine?

PHP is not a template engine, but a language that can be used to write templates, or template engines. A template engine is not just a language, but also the programming API that allows the scripts to locate, organize templates or assign the data from the script to them.

How to create a custom WordPress theme?

WordPress Custom Theme Tutorial Step #1: Creating Essential Files for Your Custom Theme. A functioning WordPress theme can consist of just two files:... Step #2: Create functions.php. Functions.php is not strictly a required file, but it provides so many benefits that 99. Step #3: Add Template ...

What is the best template engine for a WordPress website?

Templating engines are fantastic and work great with WordPress. It is purely a matter of preference as far as which one works best for your skill set and the website you are building. Sites that require lots of complex views may benefit from an engine that offers more logic in the templates like Timber or Jade.

What is the best WordPress starter theme?

Sage is a modern WordPress starter theme based on Gulp, Bootstrap, and Bower. It uses a Theme Wrapper which helps you avoid repeating the same code in every template. Sage is actively maintained and has a strong following among WordPress front-end developers.

What are custom page templates in WordPress?

Page Templates allow developers to create custom templates that can be used for individual posts and pages. For example, most themes have a two-column (content – sidebar) layout but on some pages, the user might want to just focus on the content and not show a sidebar.


1 Answers

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!

like image 110
Micah Engle-Eshleman Avatar answered Oct 04 '22 16:10

Micah Engle-Eshleman