I have the following Category loop code which I'm trying to sort by the date the entries within have been updated.
e.g if an entry was just updated within a category, this category would be at the top of the page/loop.
Here's my code
<!-- START CATEGORY LOOP -->
{% set categories = craft.categories()
.level('1')
.limit('8')
.all() %}
{% for category in categories %}
{% set offers = craft.entries({
relatedTo: category,
with: ['offerLogo'],
limit: 10,
}).all() %}
{% for offer in offers %}
{% include '_card' %}
{% endfor %}
{% endfor %}
I just can't get them to be ordered. Any help would be great!