Skip Navigation

[Resolved] Filter on date in RFG from a view of the parent CPT with filters

This support ticket is created 3 years, 6 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 9 replies, has 2 voices.

Last updated by Minesh 3 years, 6 months ago.

Assisted by: Minesh.

Author
Posts
#2069803

Tell us what you are trying to do?
Trying to include filters in a view for a date and location fields in a child RFG
I have a list of Shows with lots of info fields, each shows can have several dates and locations stored in a RFG (Shows Dates)
In the View setup I have all the filters working ok and the map showing all the marker from a nested view of the dates/location from the RFG.
Is it possible to have the Top Filter by dates and location working in this view and how?

Is there any documentation that you are following?
I found many post more or less on this topic but I must say I am confused as to whether this is possible at all?
I found this one that look promising but I tried and it seems that with dates/ location it is a little above what I can do, I could really use some help as I am starting to turn around in circle, please 🙂

Is there a similar example that we can see? not sure

What is the link to your site?
hidden link

Thank you for your time

#2069805

(Quick note, I have set the date filter on a date field from the parent CPT for now to test it out, but it does work on the date field of the RFG. Also note I would need to filter on location from the RFG if poss, thank you)

#2069995

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

The thing is that - you can add the frontend filter to your view for the custom fields that belongs to the post type you set your view to query.

To filter the posts based on the custom field that belongs to repeating field group, you will require to set your view to query the repeating field group.

You can not filter posts belongs to post type A when you set your view to query post type B.

#2070003

hello Minesh and thanks for your reply,

I see and were worried you'd say that ... does it mean I cannot have in on epage a set of filter for the parent AND the child in the same view?
So I cannot as it stand have a combination of filter applying to the CPT Show, and also filter applying to the RFG of that CPT, even that trick in a function will not work tho? it seems this is what you suggested here?:
https://toolset.com/forums/topic/searching-repeatable-fields/

Cheers

#2070007

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I see and were worried you'd say that ... does it mean I cannot have in on epage a set of filter for the parent AND the child in the same view?
==>
Yes, thats correct.

Yes, exactly, you will have to use the view's hook wpv_filter_query to find the related posts for the parent first.

If you can show me your view and tell me with what fields you want to filter your view, once I review your setup then I can suggest what we can do.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2070019

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I see the page with the view you created here: hidden link

It has most of the fields belongs to the parent (show) added as frontend filter. Now, you want two fields from the repeating field group (date and location) to be filtered.

The reference ticket you shared was about filtering one field of parent and all other fields belongs to the child post (repeating field group) so we set the view to query the repeating field group but in your case most of the fields belongs to the parent (show) and you want to filter with (date and location).

In addition to that, another problem is that you are using ajaxified view to filter the view result without reloading the page that will not work as we will require to catch the posted data. I think, you should add date and location field as repeating field to your parent post type show and whenever you add/edit parent post repeating field group entry, you should add related entry to that repeating date and location field.

#2070047

Hello again,

Darn .. shame it won't work with the existing related data to the Show's schedule.
So if I understand you correctly it can work using a repeating field (not group) for say the date.

So setting up a new field (date) as a repeating field not group this time, and I will be able to setup the filter on this repeated date field for a given show?

Will it also work for the location, so creating a new field for location as repeated field to mirror the schedule from the RFG?

I will try this, but if you can cofirm I understood you correctly, thank you again

#2070057

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

So if I understand you correctly it can work using a repeating field (not group) for say the date.
==>
Yes, it should work.

What you should do is:
- Create two new repeating fields for the parent post type "shows", one to hold the date and one to hold the location
- You should make sure when you add a new repeating field group entry, copy the value of date and location to newly created repeating date and location field for post type show.

Then it will be easy for you to add that newly created date and location field to your search view. I hope this makes sense.

#2070065

It does make sense, it's just that thinking about this option, it will be a problem as I am looking for date AND location as a group ie finding show in my area for a period of time. The way you suggest will be without link between a date and a location ... mmm it's getting harder than hoped ... any other suggestion is welcome I will give this a try and see how the client reacts.

cheers
s

#2070191

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

it will be a problem as I am looking for date AND location as a group ie finding show in my area for a period of time
==>
Yes, thats true then you will require two views. One view to search within only parent and one view to search within repeating field group items.

Even if we try to combine both parent search fields and date and location field of repeating field group as you requested before then we will require to query all the repeating field group posts based on repeating field group to find those related repeating field group posts and then again we need to group it by parent post and it will I believe definitely affect the performance.