Created
January 14, 2022 09:04
-
-
Save bartwttewaall/3e76498bf10de5254974698955363b87 to your computer and use it in GitHub Desktop.
Order by two different conditions, but with a joined result in order to be able to use pagination
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% set currentDay = date(now)|date('Y-m-d') %} | |
{% set comingQuery = craft.entries.section('agenda') | |
.geplandeDatum(['and', '>= '~currentDay]) | |
.orderBy('geplandeDatum ASC') | |
.ids() | |
%} | |
{% set pastQuery = craft.entries.section('agenda') | |
.geplandeDatum(['and', '<'~currentDay]) | |
.orderBy('geplandeDatum DESC') | |
.ids() | |
%} | |
{% set ids = comingQuery|merge(pastQuery) %} | |
{% set query = craft.entries.id( ids ).fixedOrder(true) %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment