By default, the contents of a placeholder will be escaped. That means, HTML tags will be printed out. You can mark a section of a template to be not escaped by using the autoescape tag.

For example, to render the HTML tags in the placeholder {{ FeaturesHTML }}, use:

{% autoescape false %}{{ FeaturesHTML }}{% endautoescape %}


Filter sections allow you to apply Default Filters on a block of template data. Just wrap the code in the special filter section.

{% filter upper %}
    This text becomes uppercase
{% endfilter %}

{% filter upper %}
    {{ Title }}
{% endfilter %}

You can also chain filters:

{% filter escape|convert_encoding('UTF-8', 'iso-2022-jp') %}
    Title: {{ Title }}
    Brand: {{ Brand}}
{% endfilter %}


{% include "template_name" %}

With the include statement you are able to include one template in another. This is a very useful feature to keep your template code clean. Included templates have access to the variables of the main template.

For example, you can create a template called “gallery_type_1” with the following contents:

{% if ImageSetsArray is not empty %}
  <div class="asa2_gallery_type1">
    {% for imgSet in ImageSetsArray %} <a href="{{ imgSet.LargeImage.URL }}"><img src="{{ imgSet.MediumImage.URL }}" /></a> {% endfor %}
{% endif %}

Now, whenever you want to use this gallery code in another template, you can use the include statement with the parameter set to the name of the template you want to include:

<p>Other template code ...</p>

{% include "gallery_type_1" %}

<div>Other template code ...</div>

The great improvement using include is that you can outsource template code. Like in the example, you can use the gallery template in several other templates. When you want to update the layout of the gallery, you only have to change it once.


Inside code blocks you can also assign values to variables. Assignments use the set tag and can have multiple targets.

Here is how you can assign the bar value to the foo variable:

{% set foo = 'bar' %}

After the set call, the foo variable is available in the template like any other ones:

{# displays bar #}
{{ foo }}

This example shows how to assign the result of the WordPress function get_userdata to a variable called user_data using the magic function Magic wp.* function:

{% set user_data = wp.get_userdata( repo_author_id ) %}

The set tag can also be used to ‘capture’ chunks of text:

{% set gallery %}
    {% for imgSet in ImageSetsArray %}
        <a href="{{ imgSet.LargeImage.URL }}" rel="lightbox[{{ ASIN }}]"><img src="{{ imgSet.MediumImage.URL }}" /></a>
    {% endfor %}
{% endset %}