Hi,
I'm trying to build a custom search for tours.
In my tours meta there is a custom field multi instance date
I've create the search view but I need your help to set the data filter in the right way.
As I said for each tour I ahve many date.
In the searcj I need to allow user to chose a month and display as result the tour starting in the month user has choose.
how can I do?
Hello,
There isn't such a built-in feature within Views plugin, the default search field for custom date field is date-picker, you can not use "month" select/radio field to search the date field.
As a workaround, I suggest you setup a custom taxonomy, for example "tour-month", edit each "tour" post, setup the term value, like this:
- May 2018
- March 2019
Then you will be able to setup the month filter in custom search form as what you want.
Hi,
is not the best solution with category because I need an automatic solution-
To cath and display the month I us this [types field="partenze" index="0" format="F"][/types]
I need to set a filter where the month seleceted by the date-picker or by a custom field is equal to this value.
Hi Luo,
I used this code
[wpv-control-postmeta field="wpcf-partenze" type="select" date_format="F" url_param="wpv-wpcf-partenze"]
It works. The only problem is the output format which is in Unix timestamp format, but I need only "F" format.
As I mentioned above, there isn't such a feature, even you can use custom codes to turn the timestamp value into month value, there still be other unexpected results, for example there are two posts with date field value:
Post A: March 12th 2018
Post B: March 15th 2018
They will produce two options "March" in the dropdown menu.
Please check the taxonomy workaround as I mentioned in first answer:
https://toolset.com/forums/topic/filter-tour-by-month/#post-1135940
Ok Luo, I cannot have only the month.
But how to have the date in a date format and not in timestamp format?
As yu can see in the screenshot the option are in timestamp format
Please check our document:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-control-postmeta
The attribute "date_format" is for:
Αpplicable for a datepicker control
But in your case, it is a select menu, so it won't work.
And I don't think there is existed solution for your case. You might consider custom codes, you can also check it with our Toolset contractors:
https://toolset.com/contractors/
I use the data-picker and and set filter equal or more than.
It work fine.
Thank you