1

I'm trying to bring in all images from a matrix field but I can only get it to work with first() or last() but obviously it only shows 1 image.

I've found a few article explaining it but I can't seem to get it working.

3

Because logoSlider.image is an array of images (even if there's only one image in the array) you need an additional 'for' loop to catch all of the images (not just the first or last). Try something like this:

{% for logoSlider in entry.logoSlider %} 
   {% if logoSlider.type == 'logo' %} 
     {% for image in logoSlider.image %}
       <div class="column column-block">
         <img src="{{image.url}}" alt="{{image.title}}" />
       </div>
     {% endfor %}
   {% endif %}
 {% endfor %}

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.