I am trying to configure a View that lists a type filtered by a field that exists on a parent.
Course (has vendor field)
I have a "Course" type with a "vendor" field. I also have a "Training" type which is displayed in a list by date. I want to add an additional shotcode filter to the "TrainingView" that allows me to only show "trainings" that have a specific value of "vendor".
1. Child view named "Child view - listing training posts"
- Content selection: post_type=training
- Filter: Choose "Post Relationship - Post is a child of:" => set "Post with ID set by the shortcode attribute": child_of
2. Parent view named "Parent view - listing course posts"
- Content selection: post_type=course
- Filter: Choose filter the custom field: wpcf-vendor
- In the loop of Layout HTML/CSS/JS > Put the shortcode:
[wpv-view name="Child view - listing training posts" child_of="[wpv-post-id]"]
Then put view "Parent view - listing course posts" and suitable parameter filtering the custom field "wpcf-vendor" in your page.
- Parent view: Query all parent posts "course" with the filter by the custom field "wpcf-vendor". These post IDs will become the parameter of child view.
- Child view: Query all child posts "training" belongs to a specific parent post "course"