Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Forms & Blueprints

Archive plugin & taxonomy filter

Started by kitzunegari 7 years ago · 0 replies · 645 views
7 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 Ton Haarmans, 5 years ago
13 1135 4 months ago
Forms & Blueprints · by Hugo Oliveira, 5 months ago
0 61 5 months ago
Forms & Blueprints · by Flachy Joe, 6 months ago
9 134 6 months ago
Forms & Blueprints · by Augustus, 7 months ago
7 108 7 months ago
Forms & Blueprints · by Julien, 7 months ago
10 128 7 months ago