Twig
A modern template engine for WordPress
FAST
Thanks to its optimization the overhead compared to regular PHP code was reduced to the very minimum.
SECURE
Access only to secure data and function. This allows Twig to be used as a template language for applications where users may modify the template design.
FLEXIBLE
Twig is powered by a flexible lexer and parser. This allows the developer to define its own custom tags and filters, and create its own DSL.
Not only a simple placeholder
The Twig Engine is like a real developing code as PHP
Any Fields
Loops
Conditions
Filters
Functions
Variables
Timber
Twig + Timber
the perfect match for WordPress
The Twig Engine was created for Symfony project, but there it could be integrated also in different projects like WordPress. Timber developed this perfect integration, so the plugin take the most from this incredible library.
All WP Variables
Extension
Print the content value of any WordPress Object
Post
User
Term
Theme
Site Option
WP Query
Queried object
System
Menu
Posts
Editor Twig
Rich Text with Dynamic Content
Insert all Twig code and the text will be elaborated by the Twig Engine and the result will be display.
You can choose from 3 input modality:
- Wysiwyg
- Code
- Template File
The Twig power built in in WordPress thanks to Timber libraries.
WYSIWYG
For simple text replacement with some custom graphics
CODE
For a direct advanced code written directly on the widget
TEMPLATE FILE
Include a custom Twig Template File from your theme
DEMO
Some Twig example
Base
Filters
Functions
Site Options
Loops and Conditions
{{ function('get_post_meta', foo, 'my_custom_field', true) }}
{% endfor %}
{{ get_image(image) }}
{% endfor %}
{{ post.thumbnail.src }}
{% endif %}
<a href="{{ term.link }}">{{ term.name }}</a>{% if not loop.last %}, {% endif %}
{% endfor %}