I’m trying to sort resources by comparing 2 dates using Ditto.
The idea is to compare date_1 vs date_2, get the most recent one and order all items by descending order.
date_1 and date_2 are not always defined. So they can be 0/null sometimes.
date_1 (pub_date) is a default ModX variable that all resources have, while date_2 (eventDate) is a template variable that only a certain type of resources have.
I considered using &filter, &config or &where parameters inside Ditto but I found them insufficient.
The closest I got is this:
[[Ditto? &parents=`1,2,3,4,5` &showPublishedOnly=`1` &orderBy=`pub_date DESC, eventDate DESC` &tpl=`WhatsNewPage` &display=`all` ]]
Thank you in advance guys!!