This is based on this tutorial:
But I couldn’t get it working until by trial and error I found that the following worked:
- Create a View that pulls the child post using the filter
“Select related posts that are a child of the post set by the parent view.”
eg: “Further Works by Artist”
- Create a Content Template that uses this View eg: “Further Works” which uses the “Further Works by Artist” view to pull child posts of the parent view:
[wpv-view name="Further Works by Artist"]
- Insert the “Further Works” Content Template in the Content template used to show a single child eg: Content Template “Work Details” shows the details of a child artwork and within it we insert the view “Further Works” to show other works by the same artist. The context of “Further Works” is set to be the parent of the current post by the id=”$artist” bit.
[wpv-post-body id="$artist" view_template="Further Works"]
where $artist is the slug of the post type of the parent.
- The result is that the page is a single child post (and artwork) that has within it a Content Template that has a context of the Parent post type. So, when the “Further Works by Artist” view pulls posts from the database it is pulling children of the Artist post type which are in fact siblings of the current single child post page.