Sort articles on datefieldoutput


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?


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

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!