I'm picking a season category (spring, summer, fall, winter) in a global variable that should dictate what entries come to the top of non-season category pages. These entries are already on a category page, sorted by their main category. I need extra sorting to showcase the "Spring" entries, for instance. Something like this:
Without the season global variable chosen
- Test post 1 (Summer)
- Test post 2 (Spring)
- Test post 3 (Spring)
- Test post 4 (Winter)
- Test post 5 (Winter)
With the global variable "Spring" chosen
- Test post 2 (Spring)
- Test post 3 (Spring)
- Test post 1 (Summer)
- Test post 4 (Winter)
- Test post 5 (Winter)
Basically, I want to bring the entries that are using the chosen Global Variable Category to the top, the remaining entries can be sorted by postDate descending. These entries are in a Structure btw, if that matters.
Structure = 'generalContent'
Category Field = 'season'
Global Variable = 'season.season'
Simplified code of my category page.
{% paginate craft.entries.section('generalContent').relatedTo(category).order('lft desc') as entries %}
{% for entry in entries %}
{{ entry.title }}<br>
{% endfor %}
{% endpaginate %}