Skip to main content

Branching out with Twig

Dec 30 '16

WordPress and Drupal are frequently compared to one another and each has its pros and cons. Drupal is getting more user friendly and WordPress is getting more powerful.  Both are idiosyncratic is their own ways.

If you're entering the WordPress landscape from a Drupal orientation, sometimes maneuvering through the APIs of WordPress can be a bit of a hurdle, but there are some tools available to make switching contexts less painful (if you have to use both).

WordPress, meet Timber. Timber is a WordPress plug-in that activates a new, object-oriented wrapper for the WordPress API and a new theming layer that leverages Twig.

Twig has been around since 2009, but Drupalistas know it's a key part of the changes introduced in Drupal 8 as well. Timber's support for Twig adds some nice separation between logic and presentation layers. It also provides an elegant way to leverage Advanced Custom Fields (ACF) and makes working with images a snap.

Here are some resources to learn more about Timber and Twig:


Timber


Twig


While many folks ponder about the future of the headless CMS and frameworks galore, adoption and extension of TWIG's theming layer continues to grow in prominence. Here are some other technologies that integrate TWIG.


Technologies with Native Support for TWIG


Technologies extended with TWIG Support


If you've already mastered (or are beginning to master) Twig and need to work on Wordpress, give Timber a try.  You'll be glad you climbed out on that limb.  ;)