Skip Navigation

[Resolved] filtering by child field

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 support ticket is created 5 years, 7 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 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 4 replies, has 2 voices.

Last updated by glenn 5 years, 6 months ago.

Assisted by: Shane.

Author
Posts
#1251063
02.png
01.png

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!