Sort articles on datefieldoutput

Hi,

I have a template with some childpages and on every on this pages I have appointments.
No I show all appointments on the parent page. Now how can I sort the appointments on a datefield?

Cheers

Hi @JanStieler

You can use the following:

    page('parent')->children()->visible()->sortBy('date', 'desc')

You would use this to define the array of children sorted by date. You then loop through the array. Replace β€˜parent’ with the name of your parent page.

1 Like

Hi,
thanks. And in β€˜date’ I can use every fieldname with a date?

Yes you’d replace date by your field name. Let me know if you hit any roadblocks!