I have a matrix field with a category field. I need to group these matrix items by category and give them headings which I'll use for tabs.
This is how I'd do it for entries but is it possible for matrix?
<ul class="tabs">
{% nav category in craft.categories.group('otherAppliances') %}
{% set itemCount = craft.entries.relatedTo(category).total() %}
{% if itemCount %}
<li rel="">{{ category.title }}</li>
{% endif %}
{% endnav %}
</ul>
I think my question may be similar to How to query with relatedTo of a Relationship Field in a Matrix Field block but I can't get my head around it.
Matrix setup: