MODX Community

Filter getResources by Day of the week

HELP! I have a need to sort all of the events “publishedon” by the day of the week so all of the Friday events need to land on a Friday page. So far, I am not having any luck sorting by day. Plus, it needs to show closest one event to that specific day without it being past event.

[[!getResources?
&tpl=DaySpecificTpl
&parents=17
&showHidden=1
&limit=1
&includeTVs=1
&processTVs=1
&sortby={"publishedon":"ASC","createdon":"ASC"}
&tvFilters=publishedon==[[!getDate:date=%A]]%
]]

I don’t think what you’re trying to do is possible with getResources. I think you’ll need a custom snippet. I could be wrong.

FYI, calling getDate uncached will delay its processing. That means the &tvFilters property will be trying to process the actual tag rather than the value it will be replaced by.

Thanks for the quick reply. Would I need 7 snippets or is it possible to do it with one?

maybe something like that?
&where=`FROM_UNIXTIME(publishedon,"%a") = "Fri"`

That is doing the trick but now I can’t sortby published asc