We are using the Event Calendar pro plugin to create events and using the Toolset View legacy version to create a view with filters for events.
We want to create a checkbox filter that lists all the upcoming event start dates ('Years' only).
I have setup a couple of test events:
- Event 1 (start date: Oct 31, 2024)
- Event 2 (start date: Nov 1, 2024)
- Event 3 (start date: Jan 04, 2025)
- Event 4 (start date: Jan 25, 2025)
So the checkbox filter will have these 2 years (screenshot event-desired-result.jpg):
- 2024
- 2025
For our News page, we also have a checkbox filter that lists all the post published date (years only) by using the 'Query Filter' , Post date filter (screenshot news-years-checkboxes.jpg + news-post-date-filter.jpg)
In the 'search and pagination' section, I just added this and the filter works:
[wpv-control url_param="wpv-year" type="checkboxes" output="legacy" values="2024,2023,2022,2021,2020,2019,2018"]
For my events page, is there a way (similar to news) to display the event start years without having to create a custom taxonomy for years?
I assume it's using ' _EventStartDate', but not sure how to set that up.
Hello. Thank you for contacting the Toolset support.
The Toolset's date filters are designed to work with the values in UNIX timestamp format. That is the same format in which Toolset's own date-type field stores the values. So, for instance if you have date custom field created using Toolset the value of this date custom field will be stored as Unix Timestamp in the database table.
The Events Calendar plugin on the other hand stores the event date values as date string i.e. human-readable formats.
There are couple of ways we can do this: You can create a custom field that will hold the year value and when you save/update post you should try to extract the year value from the "_EventStartDate" field and save it to this custom field and then add this custom field as search filter to your view.
If you want to make this work using the way you shown:
In the 'search and pagination' section, I just added this and the filter works:
[wpv-control url_param="wpv-year" type="checkboxes" output="legacy" values="2024,2023,2022,2021,2020,2019,2018"]
Then I need admin access details and problem URL where you added the view and I will try to help you to make it working.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.