1

I created a field which uploads an image, and I want it to display it for each of my entries inside my for loop.

What's the code I should use to do it?

  • Is the image a field used only with one entry? Or is it a different image added to each of the entries in your loop? – Ian Nebbiolo Jul 19 '18 at 14:18
1
{% for element in elements %}
    {% set asset = element.assetFieldHandle.one() %}
    {% if asset is not null %}
        <img src="{{ asset.getUrl()">
    {% endif %}
{% endfor %}

Take a look at ElementQueries and how to handle errors

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.