Skip Navigation

[Resolved] Filter tour by month

This support ticket is created 5 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 7 replies, has 2 voices.

Last updated by domenicoS 5 years, 5 months ago.

Assisted by: Luo Yang.

Author
Posts
#1135929

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?

#1135940

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.

#1136007

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.

#1136124
Screenshot search bar-01.jpg

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.

#1136530

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

#1136548
Screenshot search bar-01.jpg

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

#1136673

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/

#1137395

I use the data-picker and and set filter equal or more than.
It work fine.
Thank you

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.