I have a search page here:
hidden link
I have set up a date field for each custom post type of teacher. I have set up a between date filter in the view:
<div class="form-group">
<label for="wpv-wpcf-teacher-date-and-time-start_min">[wpml-string context="wpv-views"]Date From[/wpml-string]</label>
[wpv-control-postmeta field="wpcf-teacher-date-and-time-start" url_param="wpv-wpcf-teacher-date-and-time-start_min"]
</div>
<div class="form-group">
<label for="wpv-wpcf-teacher-date-and-time-start_max">[wpml-string context="wpv-views"]Date To[/wpml-string]</label>
[wpv-control-postmeta field="wpcf-teacher-date-and-time-start" url_param="wpv-wpcf-teacher-date-and-time-start_max"]
</div>
I have this for the field filter:
Select items with field: Date and Time Start is a number between URL_PARAM(wpv-wpcf-teacher-date-and-time-start_min), URL_PARAM(wpv-wpcf-teacher-date-and-time-start_max)
However, nothing shows up when I set the filters (Teacher 1 has 2 dates set up, the 25th and the 27th of March. These are set up as part of a repeatable group field that contains a date field and another filed that I am not currently using).
Hi, let me be sure I understand how this is set up. It sounds like you have a custom post type "Teacher" and you have added a repeatable field group (RFG) to the Teacher post type. Your custom search View has "Teacher" selected in Content Selection, and you are trying to allow your site Users to filter Teachers by a custom date field inside the RFG. Is that accurate? If so, then you are experiencing a frustrating limitation of RFGs and Views. It is not currently possible to filter a View of Teachers by a custom field value in one of its RFGs. You can only filter a View of Teachers based on custom fields applied directly to the Teachers post type, not including those in its RFGs. Similarly, you can only filter a View of RFGs by the fields applied directly in the RFG, not in the parent post type.
On the other hand, it might be possible to set up a workaround. If the only filter necessary is this date filter, then you could set up a custom search View using the RFG in Content Selection, and filter by the custom date field. Then in the results of the View, it is possible to display information about the parent Teacher post type in each result, since each RFG row is essentially a child of the Teacher post type in a one-to-many post relationship.
Or with more work you could use a filtered View of RFGs to produce a comma-separated list of parent post IDs. This list would include duplicates, but you could pass the list into another View's post IDs filter as a shortcode attribute. This would allow you to display a list of parent posts without duplicates.
Let me know if you would like more information about anything I've mentioned here.
I have solved the issue by switching to an RFG search instead that then displays links o the parent where the various RFG fields will be displayed.
How do I search by time? There doesnt seem to be an option for this? I have date fields that allow both date and time.
There isn't a time input field for custom search views unfortunately, only numeric inputs that would allow you to search by timestamp. For most users it's not very useful, since Unix timestamps are somewhat technical.
My issue is resolved now. Thank you!
What's the reason for there not being one? It cant be that difficult to convert a combination of time and date into a unix time stamp?
I don't think it's a problem with difficulty, it's a feature that was never implemented and has not received enough attention to be added. Another ticket here: https://toolset.com/forums/topic/filtering-on-date-and-time-using-toolsets-calendar-missing-a-time-input/
Since it's not under development or planned in an upcoming release, I suggest submitting your request here to add attention to the missing feature:
https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/
Otherwise in the meantime, you would have to use custom Javascript to manage custom time input fields, and then use the wpv_filter_query API to programmatically adjust custom search queries using those times.