For the complete documentation index, see llms.txt. This page is also available as Markdown.

Template engines

Advanced Views comes with a few template engines pre-built, giving you the freedom to choose one that is closer to your needs.

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.

Comparison

Feature
vanilla PHP
Twig
Blade

Minimum PHP version

-

7.4 (as WordPress)

8.2.0

Shortcuts support

partial

yes

yes

Output auto-escape

no

yes

yes

Available functions

any PHP

any PHP

1. PHP

<? foreach ($categories["value"] as $index => $term_item): ?>
    <a target="<?= esc_html($term_item["target"]); ?>" class="acf-view__categories-link" href="<?= esc_html($term_item["value"]); ?>">
        <?= esc_html($term_item["linkLabel"] ?: $term_item["title"]); ?>
    </a>
<? endforeach; ?>

Pros:

Cons:

  • no output auto-escape

  • verbose constructions

2. Twig

Twig is developed by the Symphony framework creators.

Pros:

  • short and clean syntax

  • output auto-escape

Cons:

  • alternative construction and function names

  • no access to WordPress functions (requires manual registration)

3. Blade

Blade is developed by the Laravel framework creators.

Pros:

  • short and clean syntax (with names matching PHP)

  • full access to WordPress functions

  • output auto-escape

Cons:

  • requires PHP 8.2+

Last updated