We would like to filter (search) a View by year, using a custom field "Start date." Is there a way to do that?
We understand Toolset Views is obsolete, and we do not use Toolset Views, but we note "Building Custom Searches for Any Content Type" (https://toolset.com/documentation/legacy-features/views-plugin/front-page-filters/). We believe that's not relevant to custom search blocks in Views in Toolset Blocks. Is that right?
We have used Toolset Types to create a custom post type called "Event" with a custom field called "Start Date" (actually date and time).
We have used Toolset Blocks to create a View block with a Custom Search Filter block for Start Date. We've explored the various comparison settings.
But we're trying to search/filter by year. For example, we set "Type of Control" to "Text Input." When the visitor enters "2019," that should show events with Start Date in 2019. (Or even better, a drop-down list of years.)
I expect there's no way to do that, but I thought I'd ask.
How do I assign a support request to a particular Toolset rep when they invite me to do so?!
In this request, Jamal suggests I assign this question to him:
https://toolset.com/forums/topic/clarify-creation-of-taxonomy-archive/
But I don't see a way to do that.
In this other support request, Jamal wrote, "... you want to display the posts from the current month, you can add a filter on the post date."
https://toolset.com/forums/topic/clarify-creation-of-taxonomy-archive/
Does that mean there's a way to let the visitor select a month (or a year) and filter posts to that month? That's what I'm looking for!
(I'm asking about a custom field "Start Date" rather than the post date.)
Hello Steve,
Indeed, I told you to assign the ticket to me, but I checked now and it is not possible in the Toolset support forum. That was a quick text snippet that I was using while working with the WPML support team. I confirmed that the ticket assignment is not activated on the Toolset support forum, so, I'll update my snippet. Sorry for the confusion 🙂
Toolset views plugin is now considered a legacy plugin, but we still support it for bug fixing. You can activate the legacy editor in Toolset->Settings->General(tab)->Editing Experience.
Regarding the possibility to filter by year, I am afraid, it is not an available option. But we can still achieve it using a workaround. For example, if you will be filtering by a selected number of years, you can create the dropdown using HTML, and hook it into the view's query filter with custom PHP code. You can see an example in the following reply https://toolset.com/forums/topic/create-a-filter-to-show-news-by-year/#post-362933
But, if you have multiple years, or you expect that other years will be added, I'll suggest that create an additional field to store the year. And you can add custom PHP code to sync the year from the date field. That way, you can add a filter for that field and have the dropdown generated automatically. In that case, you won't need to add custom code to change the view's query filter. You will just need one custom code to sync the year from the date field to this new field. Does it make sense?
I hope this helps. Let me know if you have any questions.
OK, thanks for the quick answer. And thanks for the interesting link.
By the way, I believe I understand what you meant when you said "... you want to display the posts from the current month, you can add a filter on the post date." (I quoted that yesterday.) I believe you were referring to filtering the posts displayed by a view, not a custom search offered to web site visitors.