I am trying to: Display View in a Content Template for Artist with thumbnail of the first image from Artwork via relationship Artwork Artists (Artworks [0 .. 1] << Artists [0 .. 100]). There is repeatable field of images uploaded for Artwork. I created View with a Query filter for Artwork Image as " Select posts in Any relationship that are related to the Post where this View is shown". and defined [types field="image-of-artwork"][/types] in the loop for that view.
Link to a page where the issue can be seen: hidden link (No items found)
I expected to see: related artwork thumbnail from (hidden link) in Content Template
Instead, I got: Not found
Hi, the reason no Artwork Images appear is because Artwork Images are not directly related to Artists. See this View:
hidden link
This View is set up to find Artwork Images directly associated with the current Artist post. However, Artwork Images are associated with Artists only indirectly (Artists > Artworks > Artwork Images). So you need one more nested View to make this work correctly. Here's how I would do it:
- Duplicate the View "list-of-related-artwork-for-artist"
- Scroll down to the Loop editor and replace the loop contents with your Single Image view, like this:
[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<wpv-loop>
[wpv-view name="artwork-image-view-single-image"]
</wpv-loop>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
[/wpv-no-items-found]
[wpv-layout-end]
- Edit the Artwork Image Single Image View and change the Post Relationship Query Filter to select the option as related to "The current post in the loop".
- Edit the Content Template for Artists and delete the Single Image View shortcode, since it is now nested in the new View. Replace it with the new duplicated View shortcode, and add the "limit" option to display only the first Artwork result, like this:
[wpv-view name="duplicate-list-of-related-artwork-for-artist" cached="off" limit="1"]