0

Im looking up the last 2 entries like this

{% set entries = craft.entries.section('report').limit(2) %}

My entry got an assets field called 'portfolio'. I would like to retrieve 8 images in random order. How would I do this?

2

You could try something like:

{% for entry in entries %}
  {% for image in entry.portfolio.orderBy('RAND()').limit(8)
    <img src="{{ image.getUrl() }}">
  {% endfor %}
{% 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.