.. include:: _include.rst
.. highlight:: html+jinja
.. _template_syntax:
#####################
Template Syntax
#####################
With |productname| you can create conditional templates. This means you can manipulate the placeholder contents or inlcude dynamic content, depending on the value of placeholders (see all available :ref:`placeholders`).
|productname| uses the power of the famous `Twig `_ template engine for PHP to realize conditions, loops and filters in templates. Hence you can use the default functionality of Twig.
Additionally |productname| provides **special filters and functions** to optimze the usage with WordPress. You can **access WordPress internal functions** with {{ wp.[function_name] }}, for example {{ wp.get_post(8).post_title }} which will display the post title of the post with ID 8. This gives you a great flexibility in creating **custom, dynamic templates**.
.. rubric:: Language constructs
Conditional templates have two main language constructs.
.. rubric:: {{ placeholder }}
{{ placeholder }} is used to print the contents of the available :ref:`placeholders`.
For example, to embed the product title in your template, use:
.. code::
{{ Title }}
.. rubric:: {% statement %}
{% statement %} is used to execute statements. Statements can be :ref:`template_conditions`, :ref:`template_loops` and :ref:`template_functions`.
This example uses the ``if`` condition to only output the product features if the placheolder {{ FeaturesHTML }} is not empty:
.. code::
{% if FeaturesHTML is not empty %}
{{ FeaturesHTML }}
{% endif %}
.. note::
Inside a statement placeholders do not have to be embedded in {{ }}
For more details about the syntax check the following chapters:
.. toctree::
:maxdepth: 1
template_filters
template_custom_filters
template_conditions
template_loops
template_functions
template_tags