An open API service indexing awesome lists of open source software.

https://github.com/ethercreative/w8

Sort entries by category and weight
https://github.com/ethercreative/w8

craft-plugin craftcms craftcms-plugin craftcommerce sorting sorting-algorithms wip

Last synced: 7 months ago
JSON representation

Sort entries by category and weight

Awesome Lists containing this project

README

          

# W8
Sort entries and products by category and weight

**[WIP] Not production ready**

## Usage

```twig

{# Sort by element weight #}
{% set entries = craft.entries.section('news').order('w8') %}
{# or #}
{% set entries = craft.entries.section('news').order('w8|self') %}

{# Sort by category field #}
{% set entries = craft.entries.section('news').order('w8|categoryField') %}

{# Sort by multiple #}
{% set entries = craft.entries.section('news').order('w8|self|categoryField|otherCategoryField') %}

{# Sort by category field and specify max level/depth #}
{% set entries = craft.entries.section('news').order('w8|categoryField:2') %}

```