Skip Navigation

[Resolved] Query does not pick anything from related repeatable group

This support ticket is created 5 years, 1 month 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 1 reply, has 2 voices.

Last updated by Christian Cox 5 years, 1 month ago.

Assisted by: Christian Cox.

Author
Posts
#1206399

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

#1206460

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"]
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.