Skip to content
● Grav 2.2 is out: 2x faster cold starts and 96% less memory on big sites. Read the announcement →

Archive plugin & taxonomy filter

Started by kitzunegari 8 years ago · 0 replies · 870 views
8 years ago

Hello,
for anyone wants to display Archive of posts and is struggling looking for a filter with multple or different categories, I'm going to show you a possible workaround:
 

    1. Set a custom field in \system\blueprints\pages\default.yml

      for eg.

      YAML
                  header.taxonomy.CUSTOM:
                    type: selectize
                    label: Custom
                    classes: fancy
                    default: Custom
                    validate:
                        type: commalist
      

       

    1. Add custom field to taxonomies list in \system\config\site.yaml
      taxonomies: [category,tag,CUSTOM]
       

 

    1. Change filter type in \user\plugins\archives\archives.yaml

      for eg.

      enabled: true
      built_in_css: true
      date_display_format: 'F Y'
      show_count: true
      limit: 12
      order:
      by: date
      dir: desc
      filter_combinator: and
      filters:
      CUSTOM: CUSTOM
      taxonomy_names:
      month: archives_month
      year: archives_year

Now the filtered list will be displayed in the sidebar:

list|303x254

last edited 01/27/19 by kitzunegari

Suggested topics

Topic Participants Replies Views Activity
Forms & Blueprints · by Japhy, 5 hours ago
0 12 5 hours ago
Forms & Blueprints · by FrViPofm, 3 weeks ago
5 274 3 weeks ago
Forms & Blueprints · by Ton Haarmans, 6 years ago
13 2265 8 months ago
Forms & Blueprints · by Hugo Oliveira, 9 months ago
0 729 9 months ago
Forms & Blueprints · by Flachy Joe, 10 months ago
9 810 10 months ago