I'm loading multiple matrix blocks from multiple entries to the homepage if the date is today or in the future. So far this works but now I'm trying to sort the blocks by date and limit the output to 10 dates.
Here's the code I'm currently using:
{% for entry in craft.entries.section('projects') %}
{% for block in entry.agendav2 %}
{% if block.Datum >= now %}
{% switch block.type %}
{% case 'Datum' %}
<table class="agenda_item">
<tr>
<td class="table_title performance-date table_col-2-3">{{ block.Datum|date("d.m.Y") }}</th>
<td class="table_title event-location table_col-1-3">{{ block.locatie }}</th>
</tr>
<tr>
<td class="performance-title table_col-2-3"><a href="{{ entry.url }}">{{ entry.globalTitle }}</a></td>
<td class="event-title table_col-1-3"><a target="_blank" href="{{ block.eventUrl }}">{{ block.evenement }}</a></td>
</tr>
</table>
{% endswitch %}
{% endif %}
{% endfor %}
{% endfor %}
Right now it's loading every upcoming date per entry like:
- Entry 1: 31-01-2018
- Entry 1: 01-02-2018
- Entry 1: 02-03-2018
- Entry 2: 30-01-2018
- Entry 2: 06-02-2018
- Entry 2: 03-03-2018
- Entry 3: 23-01-2018
- Entry 3: 25-01-2018
- Entry 3: 08-03-2018