This package is abandoned and no longer maintained. The author suggests using the timkelty/craft-groupby package instead.
There is no license information available for the latest version (1.1) of this package.

A Craft plugin (Twig filter) for grouping entries.

1.1 2016-08-25 14:13 UTC


A Craft plugin (Twig filter) for grouping entries.


  • param 1: Attribute to group by, in dot notation
  • param 2: Group un-grouped entries by a key. Defaults to false, meaning un-grouped items are removed. These entries are always added to the end of the returned array.
{% set allEntries = craft.entries.section('blog').find() %}
{% set allEntriesByCat = allEntries|groupBy('myCategoryField.slug', 'unGrouped') %}


In it's simplest form, the groupBy filter works like Craft's native group filter.

{% set allEntries = craft.entries.section('blog').find() %}
{% set allEntriesByYear = allEntries|groupBy('postDate.year') %}

However, groupBy can alos group by nested objects:

{% set allEntriesByCat = allEntries|groupBy('myCategoryField.slug') %}
{% set allEntriesBySection = allEntries|groupBy('section.title') %}

And you can even get really crazy if you want:

{% set allEntriesByNestedCat = allEntries|groupBy('myEntriesField.myCategoryField.slug') %}
{% set allEntriesByMatrix = allEntries|groupBy('myMatrix.myEntriesField.dateField.localeDate') %}


Motivation for plugin on StackExchange