0

I have media content I want to add an option for viewers can view by year from select option. I have added Published on and then checked on exposed with year checkbox as you seen in snapshot but it showing as field instead years like: 2018, 2019 in dropdown/select option.

enter image description here

enter image description here

enter image description here

The 1st problem is select/option should show as years like 2018, 2019 so on.... and 2nd problem is when I clicked on apply filter it showing query as ?sort_by=publish_on&sort_order=DESC so manually I changed it to ?sort_by=2019&sort_order=DESC but still not showed posts which published on 2019.

  • 1
    I don't understand what you are trying to do. I guess you want to FILTER by year (not sort!). Then you can SORT ascending or descending. (The year checkbox within the sort criteria is only the granularity, meaning a date like 2019-12-31 would be treating exactly the same as a date like 2019-01-01) – Hudri Sep 12 at 10:11
  • @Hudri exactly I want to that but I am just trying to filter by year not whole date eg: 2019-01-01 – user8969730 Sep 12 at 10:14
  • 1
    You can create an exposed filter criteria with "Grouped Filters". This allows to manually define filter options like (Label) 2019 => (Criteria: Is Between) 2019-01-01 & 2019-12-31. But you have to create each year manually. – Hudri Sep 12 at 10:32
  • it's not dynamic like every upcoming year I need to add new group eg: 2020, 2021 ... – user8969730 Sep 12 at 10:49
  • later I have tried with group options and added value between 2018-01-01 00:00:00 to 2018-12-31 23:58:00 with option title of 2018 then go to frontend and select 2018 option and apply so then none of posts are shown.. – user8969730 Sep 12 at 12:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.