1

I'm in a need to convert an existent design into wordpress and before starting I was curious to know: Is it correct to use pure "naked" PHP when adding logic to templates in wordpress? Wordpress uses no template engine like Twig or Blade by default? I'm pretty suprised, so before starting to work on that project and doing everything in pure PHP (with the opening <?php and closing hassle ?>) I wanted to ask here. This way of doing things seems very outdated to me.

4

Correct, there is no PHP templating engine built into WordPress. This does however give you the flexibility to use a templating engine such as Twig or Blade (and I have worked on sites using each of those), or even completely headless using the REST API.

  • Thanks, and that works out of the box by installing a plugin (I guess), for blade for example? – chevallier Aug 19 '18 at 12:55
  • 1
    Yes it appears there are plugins for that. You could also manually include the libraries I'd expect – cameronjonesweb Aug 19 '18 at 14:43
0

Have a look at WordPress Codex

The WordPress Codex is intended to be an encyclopedia of WordPress knowledge.

PHP Coding Standards

Some parts of the WordPress code structure for PHP markup are inconsistent in their style. WordPress is working to gradually improve this by helping users maintain a consistent style so the code can become clean and easy to read at a glance.

Codex Theme Development

This article is about developing WordPress Themes. If you wish to learn more about how to install and use Themes, review Using Themes. This topic differs from Using Themes because it discusses the technical aspects of writing code to build your own Themes rather than how to activate Themes or where to obtain new Themes.

Also see: CodeX Guide

WordPress Codex - How To Use It To Learn WordPress

-1

Yes. I agree, WordPress PHP is rather outdated at times.

As Invariant Change says, page builders offer a great solution. Divi is amazing. If you want something a little trimmed back, there is also the Genesis Framework.

However, because this is so trimmed back, you end up adding lots of plugins to get it to do what you want it to do, which then means lots of maintenance, debugging and slower site with all the server calls, which is why Divi is so good. It's all contained in a fast streamlined self-contained package that is designed from the top up to work in unison, rather like Apple products.

Genesis is best suited to theme developers who intend to resell their themes in markets such as Envato.

  • 1
    Thanks. Yes, I used Genesis Framework and stopped using it for the very reason you state. It's great for the people that are reselling, but for me, who wants something that lets me make a good site quickly, Divi is far superior. Time is money, Divi means more profit :) – Invariant Change Aug 19 '18 at 13:31
  • 1
    I just checked. Divi has a built-in template engine. So probably the best solution? – Cryptomanic Aug 19 '18 at 13:35
  • 1
    Oh yes. I should have mentioned that. The template system Divi uses lets you assign who pages as template, or individual elements. You can also make them global templates, which means, if you update it, it updates every instance of it site wide. They are adding for features to it the template engine soon also, so it will become even more powerful. – Invariant Change Aug 19 '18 at 13:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.