Hope your team is off to a great start to the new year. Real quick, can't wait for the 3rd hotel booking case study post, and also would be great to see a 2020 roadmap post like you did in years past. Anyway on to my question.
What I need to do: Display / list my trip dates (and their details) by month ascending.
My trips are a custom post type. Each trip can have multiple departure dates. I've created a custom cloneable group field with the following fields; title, date, price, availability.
I'm creating a new page to display "All Trip Dates" broken out by month. Problem is I'm currently not using the date field because it doesn't allow for multi select dates. Just using plain text field for date.
1) Add the ability for multi select to the date field. Any chance you could add this to the date field? I know a your users have requested it but what's the reason it hasn't been added? Is it a pain to maintain? It would be an excellent addition! Then query by date and display trip dates for May.
2) Combine / merge two date field outputs. If I had a "start date" and "end date" how would I merge the two so the output would look like, May 24 - 29, 2020 or May 31 - June 4, 2020? So that I could then query by date and display all dates for say "May".
3) Make "group fields" available within the select advanced field options. So not sure how realistic this option is but trying to think of another way. If I created a new custom group field for "May" then added the "select advanced" field - could I somehow tell it to display the custom post type "trips" but then also display each trips "custom group fields"? Then that way I'd just manually select each trip date in May to display.
What are your thoughts for best approach? Option 1 would be amazing but I don't know all the reasons behind.
Thanks in advance!
Real quick, can’t wait for the 3rd hotel booking case study post
The technical part is done. We're finishing some details in the post and will publish it soon.
and also would be great to see a 2020 roadmap post like you did in years past
Yes, we're planning to do the same this month. Timeline is quite tight in the last couple of months :(.
Add the ability for multi select to the date field
The problem is that the jQueryUI datepicker library doesn't support selecting multiple dates. I suggest setting the date field cloneable, so you can add more dates if you want.
If you want to query them, then there are 2 options (FYI, cloneable fields save data in serialized format, which makes normal query useless):
2) Combine / merge two date field outputs. If I had a “start date” and “end date” how would I merge the two so the output would look like, May 24 – 29, 2020 or May 31 – June 4, 2020? So that I could then query by date and display all dates for say “May”.
You can combine the way you want. I'd suggest using something like "2020-05-10|2020-06-01", e.g. separating dates by a special character (|, :, #, @) and format dates in a standard format (Y-m-d). That way you can query by values.
3) Make “group fields” available within the select advanced field options.
Another way to think about this issue is using the Conditional Logic extension. E.g. when you select a value in the select advanced field, then show the corresponding group.
I hope my answers give you some ideas to implement that. These are advanced (and rare) use cases, and need some creative thinking.
Thanks for the detailed reply. Regarding multiple select dates - is there a jQueryUI that does support this? And if so would you all look into adding it? This would be a huge feature.
Besides FacetWP how do you display data that's cloneable / serialized?
Regarding the last option, using the Conditional Logic extension - I'm not following. So I would create a new custom fields section and call it "trip-cal". Then add a group field for each month (Jan, Feb, etc). Then add the Select Advanced field - but this is where I'm lost. How would I use the conditional logic to pull in my trip dates that are attached to different "custom field" group?
Still needing a way to display trip dates by month but not seeing the best route to take?
Thanks in advance.
Regarding multiple select dates – is there a jQueryUI that does support this? And if so would you all look into adding it? This would be a huge feature.
I'm afraid jQueryUI doesn't support this. You can see details here: jqueryui.com/datepicker/.
My suggestion is using clonetable date picker, which allows you to do the same thing.
Besides FacetWP how do you display data that’s cloneable / serialized?
For displaying data, please see this docs. You need to use some coding, though.
Regarding the last option, using the Conditional Logic extension – I’m not following. So I would create a new custom fields section and call it “trip-cal”. Then add a group field for each month (Jan, Feb, etc). Then add the Select Advanced field – but this is where I’m lost. How would I use the conditional logic to pull in my trip dates that are attached to different “custom field” group?
This is a sample code that I have: https://pastebin.com/5mc6jtJv. Please try it and see if that's similar to what you have in your mind.