New answers tagged

1

You could sort using the multisort filter (docs) then paginate using Yii's ArrayDataProvider - see this post for reference. {# Fetch your entries and order by theYear descending #} {% set allEntriesByYear = craft.entries() .section('library') .orderBy('postDate DESC') .theYear(':notempty:') .with(['theYear']) .all() | multisort(e => e....


0

For this kind of thing, I don't see much advantage of using a category relationship for the years (unless each category actually has further meta data or content held against it) - I'd probably just use a normal number field and get the editors to type in the year (or select from a pre-made dropdown if the range is reasonable)... But that doesn't help you ...


Top 50 recent answers are included