Smart templates in Advanced Views
Smart templates combine HTML with template engine expressions. Advanced Views includes several built-in template engines, allowing you to choose the one that best fits your workflow.
Benefits over drag-and-drop page builders:
Full control over the markup
Advanced conditional logic
The ability to include any WordPress (or PHP) function call
Benefits over traditional theme templates:
Pre-loaded variables, ready to use
Automatic template and markup generation
Built-in template validation
This approach gives you the flexibility of hand-crafted templates while eliminating much of the complexity and repetitive work typically involved in coding.
1. Template engine setting
You can setup the default template engine in the plugin settings, and it'll be used for all the new Layouts and Post Selections.
Meanwhile, you can choose any template engine inside a particular item, as well as mix items with different template engines - e.g., create a Post Selection with Twig and choose the item Layout made with Blade.
This way, you can safely give a try to a new template engine, or gradually migrate the old codebase.
2. Template engines comparison
Minimum PHP version
-
7.4 (as WordPress)
8.2.0
Shortcuts support
partial
yes
yes
Output auto-escape
no
yes
yes
2.1) PHP templates
Pros:
well-known syntax
full access to WordPress functions
shortcuts for opening tags and control syntax
Cons:
no output auto-escape
verbose constructions
2.2) Twig templates
Pros:
short and clean syntax
output auto-escape
Cons:
alternative construction and function names
no access to WordPress functions (requires manual registration)
2.3) Blade templates
Pros:
short and clean syntax (with names matching PHP)
full access to WordPress functions
output auto-escape
Cons:
requires PHP 8.2+
Last updated