SEOshop Documentation

Manipulation filters

date

The date filter formats a date to a given format.

{{ post.published_at | date("m/d/Y") }}

json_encode

The json_encode filter returns the JSON representation of a string.

{{ data | json_encode }}

t (translate)

The t filter can be used to translate texts. You can only translate predefined texts used in our default themes.

{{ 'Popular products' | t }}

Output:

Populaire producten

capitalize

The capitalize filter capitalizes a value. The first character will be uppercase, all others lowercase.

{{ 'my first car' | capitalize }}

Output:

My first car

upper

The upper filter converts a value to uppercase.

{{ 'welcome' | upper }}

Output:

WELCOME

lower

The lower filter converts a value to lowercase.

{{ 'WELCOME' | lower }}

Output:

welcome

reverse

The reverse filter reverses a sequence, a mapping, or a string.

{% for product in products | reverse %}
  ...
{% endfor %}

{{ '1234' | reverse }}

Output:

4321

sort

The sort filter sorts an array.

{% for product in products | sort %}
  ...
{% endfor %}

chunk

Chunks an array into size large chunks. The last chunk may contain less than size elements.

{% for tags in shop.tags | chunk(5) %}
  <ul>
    {% for tag in tags %}
      <li>{{ tag.title }}</li>
    {% endfor %}
  </ul>
{% endfor %}

Output:

<ul>
  <li>Tag 1</li>
  <li>Tag 2</li>
  <li>Tag 3</li>
  <li>Tag 4</li>
  <li>Tag 5</li>
</ul>
<ul>
  <li>Tag 6</li>
  <li>Tag 7</li>
  <li>Tag 8</li>
  <li>Tag 9</li>
  <li>Tag 10</li>
</ul>
<ul>
  <li>Tag 11</li>
  <li>Tag 12</li>
  <li>Tag 13</li>
</ul>

parts

Slices an array into size parts. The last part may contain less elements than in the other parts.

{% for tags in shop.tags | parts(3) %}
  <ul>
    {% for tag in tags %}
      <li>{{ tag.title }}</li>
    {% endfor %}
  </ul>
{% endfor %}

Output:

<ul>
  <li>Tag 1</li>
  <li>Tag 2</li>
  <li>Tag 3</li>
  <li>Tag 4</li>
  <li>Tag 5</li>
</ul>
<ul>
  <li>Tag 6</li>
  <li>Tag 7</li>
  <li>Tag 8</li>
  <li>Tag 9</li>
  <li>Tag 10</li>
</ul>
<ul>
  <li>Tag 11</li>
  <li>Tag 12</li>
  <li>Tag 13</li>
</ul>
Was this article helpful? Yes No
One moment please
Thanks for your feedback.