Skip to content

Instantly share code, notes, and snippets.

@zomars
Created July 26, 2017 21:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zomars/b9c0b60063536aad09d5b1b5d9053698 to your computer and use it in GitHub Desktop.
Save zomars/b9c0b60063536aad09d5b1b5d9053698 to your computer and use it in GitHub Desktop.
Print a table from Advanced Custom Fields: Table Field using Timber in Twig
{% if table %}
<table>
{% if table.header %}
<thead>
<tr>
{% for th in table.header %}
<th>{{ th.c }}</th>
{% endfor %}
</tr>
</thead>
{% endif %}
<tbody>
{% for tr in table.body %}
<tr>
{% for td in tr %}
<td>{{ td.c }}</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment