2

Is there a way to pull out all entry fields for an entry by their handle so they can be looped through?

For example rather than doing each field manually like {{ entry.title }}, {{ entry.description }} and {{ entry.date }}, just do a loop.

{% for field in entry %}
    {{ field.fieldHandle }}
{% endfor %}
3
  • Hey Lettie, have at the question linked above and let us know if it solves your problem.
    – carlcs
    Aug 18 '15 at 13:04
  • Cheers @carlcs that's certainly helped. Quick question I want to also check if the field is a matrix field and then pull out all the block handles and content. I've tried: {% if field.fieldType == 'Matrix' %} <strong>Matrix Field: </strong> {% endif %} But with no luck also tried just field.type and lower case matrix. What am I missing? Cheers.
    – Lettie
    Aug 19 '15 at 9:37
  • Ignore that was almost there worked it out field.type == 'Matrix' thanks for you help.
    – Lettie
    Aug 19 '15 at 9:47