Template library for WordPress [closed]

Let’s address possibility for starters.

There are two parts to front end output in WordPress:

  1. Theme template system, which is pretty flexible and relatively easy to adjust, although mostly PHP-centric
  2. Template tags (and related) functions, which are extremely PHP–centric and vary wildly as to how easy they are to adjust

So implementing templating engine in WP in general isn’t just a possibility, it’s a practical and real thing. WP solutions (of various quality and maintenance state) exist for most mainstream PHP-related templating engines.

But is it practical?

Same circumstances dictate that while it is relatively easy to start on templating engine implementation, it’s very hard to finish at feature parity with WordPress core.

The typical approaches are:

  • bypass from template to WP functions transparently (giving up on some of template layer discipline and advantages)
  • step away from WP’s APIs in favor of creating and using own original APIs/data structures in template layer

So as far as practicality goes — templating engine implementations excel at contained projects and use cases, such as web agencies using them for their clients.

For generic wide–market theme solutions WordPress is unfortunately too old and inflexible to be fully adapted to alternative templating options.

Plugins, as much more contained and varied units, can make use of templating much easier. They don’t have to adhere to same conventions as themes and can just offer/enforce their own.

tech