Hi all

I have a numerical ordered collection and I would like to do something similar to this → grouping entries by date, but with an other fieldtype for grouping than the date.

Use case: A list of all collection entries, different projects in different cities, grouped by their city names. The final rendering should look like this:

<h3>New York</h3>
<ul>
    <li>Project 1</li>
    <li>Project 2</li>
</ul>
<h3>London</h3>
<ul>
    <li>Project 3</li>
</ul>
<h3>Paris</h3>
<ul>
    <li>Project 4</li>
    <li>Project 5</li>
</ul>

Adapting the group_by_date example, the template could look something like this.

{{ collection:projects filter="city_name" as="entries" }}
    {{ city_groups }}
        <h3>{{ city_group }}</h3>
        <ul>
            {{ entries }}
                <li>{{ title }}</li>
            {{ /entries }}
        </ul>
    {{ /city_groups }}
{{ /collection:projects }}

I know I need to write a custom filter, but unfortunately I have no clue how to write this in PHP. Maybe someone did already something similar?

Thank you very much. Daniel