[Resolved] filtering by child field

We have one known recurring issue with WordPress 5.3.1 --> Dynamic Source no longer provides the feature image data. We are aware of it and a fix will be released for it soon.

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.

This thread is resolved. Here is a description of the problem and solution.

Problem:

The issue here is that the user wanted to filter their parent view by the child post custom field.

Solution:

Unfortunately no this is not possible. You can only filter a post view based on the values that are on the post that the view is displaying.

This topic contains 4 replies, has 2 voices.

Last updated by glenn 6 months ago.

Assigned support staff: Shane.

Author
Posts
#1251063

I am trying to: filter 'trainingen' by startdate of the child 'coursedate' (with post relationship)

Link to a page where the issue can be seen: hidden link under the section 'aankomende trainingen'

I expected to see: only 'trainingen' that have 'coursedates' coupled that have a startdate in the future.

Instead, I got: No results.

I added screenshots of my setup. To clarify, traingnen has a child relationship 'coursedates'. These list al the dates for the training. Now i want a view where i filter to show only trainingen with coursedates in the future.

#1251135

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Glenn,

Thank you for contacting our support forum.

Actually no this is not possible to do. You are not able to filter a view with custom fields from another CPT even if the post is in a relationship.

What you can do is to create a view for the child, then instead of displaying the child information, you tell types to display its parents.

Technically you will be filtering the child posts but displaying the parent information in the view.

Please let me know if this is clear or if further clarification is needed.

Thanks,
Shane

#1251625

Hi Shane,

i think i understand how i can solve my issue with your comment. I just have one question i will probably run into. I only want to show 5 'trainings' and show all dates of that training. However how can i limit the view to only show 5 'trainings' (since i will now be queriyng for 'dates').

I hope i made my question clear

Kind regards,

Glenn

#1251787

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Glen,

So this is the issue now. Since the view is displaying courses now instead of training you are essentially limiting it to 5 courses. So if the first 5 courses that are being displayed have the same Training, you will see the same name for each listed item.

Thanks,
Shane

#1271717

My issue is resolved now. Thank you!