1
2
3
4
The Problem:
On a CMS with many items, We want to specify the order of the first 4 items. However, with Webflow's native sorting, we have to fill in the Sort order for all items because items with an empty Sort order are detected as lower than 1, so they will be shown first, followed by 1, 2, 3, and 4. This script will change that.
How to Use the Script:
- Copy the script and paste it just before the closing </body> tag. <script async src="https://cdn.jsdelivr.net/gh/jeminids/webflow-codes@sorting-cms_v1.3/sorting-cms.min.js"></script>
- Create a Sort field on the CMS and fill it with the desired values. The lowest value will be shown first.
- There are only one attribute to add, data-sort={{ sort }}. Add it to the Collection Item of the CMS and connect it to the Sort CMS we just created.
- It's done 🎉