Hello, I wanted to see if there was a way to use the Relationship Field with the Post Type set to Attachment and be able to view a thumbnail of the image to select from since some images may have the same Title.
The Image Field Type is fantastic, but since you have to create a new one for every image, it’s less optimal if you need to be able to connect over 10 images to a Post. This would also work well if every time you added an image, there would be a button “add another image”.
Thanks for the quick response. I’m still not clear on how the Relationship Field could be used with Attachments (images) with the ability to see a thumbnail of the image you are selecting. If there is a way, I’d be interested in knowing.
The good news is that I somehow missed the Repeater Field Add-On with the Image Sub Field, and that does look like it would work well for my needs.
I was going to mark this as solved, but just curious about the first part of it if possible. It that part isn’t doable, just LMK and I can call it solved.
To use the relationship field, just create a relationship field, set the post_type setting to ‘attachment’ and toggle the ‘thumbnail’ element setting.
Now your relationship field will show all attachments with a thumbnail!
This is good for selecting images, but it won’t allow you to upload any via the relationship interface
Interesting. I don’t see a “Thumbnail” listed in the Element area. I only see “Featured Image”, “Post Title”, & “Post Type”. That’s okay though. I like the Repeater Field Add-On option since you can upload & edit photo’s using that method.
Thank you for all of your help.
Thanks for the follow up. Your right! Sorry, I forgot that the setting is for featured image.
perhaps I need to take this into consideration with the attachments and return the thumbnail instead.
Can you test it with the
Featured Image setting? Does it return a preview of the attachment?
Thanks again for the follow-up. I actually did try it with the Featured Image and wasn’t able to get that to display anything. There is a small, empty box to the left of the name, where it looks like an image might go, but it’s empty.
Thank you again.
All the best,
The topic ‘Relationship Attachment Usage’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
ACF PRO’s Flexible Content field allows you to create smaller pieces of UI and compose them into whole flexible patterns. In our latest article, we show how to use it to create swappable site sections and integrate it all in a theme.https://t.co/ZRocH8oJSp— Advanced Custom Fields (@wp_acf) January 24, 2023
© 2023 Advanced Custom Fields.