Hi there,
I'm working on a website for an art gallery. It has a couple of custom post types, such as Artist and Artwork. The two CPTs are connected via a one-to-many relationship. The Artwork post type also contains a repeatable field group with an image name, artwork title, artwork dimensions, artwork year, etc. (This architecture was suggested by Luo in https://toolset.com/forums/topic/creating-a-gallery-of-galleries/ and Shane in and https://toolset.com/forums/topic/extracting-metadata-from-a-media-file-and-outputting-it/.)
On the front-end template for the display of a single artist, I'm trying to create a grid of thumbnail images, but I'm not sure what the correct Query Filter settings ought to be in the view I'm creating. (I tried a couple of different things, but they didn't work.) To make matters more complex, I also need to display only the *first* group in the set of repeatable field groups. For example, if an Artwork post has two repeatable field groups, only the first should be output on this page.
Can y'all offer some guidance?
Please let me know if anything is unclear or you require additional information. Thank you!
Saul
Hello,
The repeatable field groups are based on one-to-many relationship, so each item of repeatable field groups is also a post.
For example, your repeatable field groups is using name "artwork information", you can try these:
1) Create a post view:
- Query posts of repeatable field groups "artwork information"
- Filter the by post type relationship
Select items from the "artwork information" group that are related to the Post where this View is shown.
- Order by "Field - toolset-post-sortorder" ascending
- display 1 item
See screenshot: rfg-1.JPG
2) In the "front-end template for the display of a single artist", display above post view
And test again.
More help:
https://toolset.com/documentation/getting-started-with-toolset/creating-and-displaying-repeatable-field-groups/#displaying-repeatable-field-groups
section "Displaying Repeatable Field Groups"
Luo,
Thanks for your response. The screenshot is very clear.
I tried configuring my own setup per your instructions, but the webpage displayed the dreaded "no items found," which makes me think something's misconfigured in the view.
Should I share credentials to my development environment?
Saul
Luo,
I think I found a thread on the support forum that describes, and solves, my exact problem:
https://toolset.com/forums/topic/need-to-display-repeatable-fields-from-a-related-post-type/
I'm all set for now.
Thanks!
Saul