Hi everyone,
I have two questions about filtering. On the website I'm working on, there is a page with a listing of companies. Now I would like the visitor to be able to filter these companies. At first I wanted use taxonomy categories for this, but since I want the admin to choose from a limited amount of categories, I decided to create a custom categories select input. In the YAML it looks like this:
header.company_category:
type: select
label: Category
multiple: true
options:
one: Design
two: Kunst
three: ICT
four: Business
five: Other
validate:
type: array
In the admin this work exactly as I like to, but I wonder if there is a way to use the taxonomy categories and limit the choice the admin has?
The next step is to actually put a filter on the company listing page. By copy-pasting some code from other themes, I tried to make a list like this:
<ul class="filter-menu">
{% for company_category in page.children.header.company_category %}
<li>
<a href="{{ blog.url|rtrim('/') }}/company_category{{ config.system.param_sep }},{{ company_category }}" class="p-category">
{{ company_category }}
</a>
</li>
{% endfor %}
</ul>
Is this the right approach? If anyone can give me nudge in the right direction, that would be awesome! Thanks :)