Ok - this is a solution I found to a problem after searching far and wide.
- this is more for help to others and to see if this is the 'correct' way to do this.
My issue was with Parent Child relationships and displaying related child posts on the child post itself.
I have this relationship:
Parent: Job Categories
Child: Job Descriptions
I wanted to show related job descriptions on each individual job description that were related by parent post type
E.g
If the Parent Job Category was: Health Care & Medical
And the Children Job Descriptions of this Post Type were: Registered Nurse, Obstetrician, Operating Theatre Technician.
On the \job-descriptions\registered-nurse post type, there is a view that displays any other posts that are related - in this case it would be: Obstetrician, Operating Theatre Technician
I tried this: https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/displaying-related-child-posts/
But couldnt get it to work.
So I found a solution like this.
Create a View that list the child post type and the fields - in this case "Job Descriptions"
(image 1)
Then select a Filter that works on the relationship - then select "The post with ID set by the shortcode attribute".
(image 2)
Now when you insert the view in to a related Child page, in this case a template that is applied to all of the Job Descriptions custom post type you need to add the shortcode parameter that calls the parent post type, like this:
[wpv-view name="related-job-descriptions" wpvrelatedto='[wpv-post-id id='@job-category-job-description.parent']']
Where "@job-category-job-description.parent" <- is the relationship that you defined.
(image 3)
Bonus:
If you want to reuse this view in the parent post type, you have to adjust the shortcode like this:
[wpv-view name="related-job-descriptions" wpvrelatedto='[wpv-post-id id="$job-category"]']
I hope this helps someone else stuck in a pickle.
Id also like a verification if this is an ok way of displaying related pages, as the documentation above didnt work for me.
Cheers