I have the following setup in WordPress:
A custom post type for Projects, which contain individual projects. For each project there is a repeater field, allowing one to add image samples.
A new custom post type is being created – called “Pitches” – that will contain individual pitches. For each pitch there is a repeater field. The idea is to allow one to add image samples from other projects (noted above).
An example scenario would be the following:
Based on the previous information, my question is this:
On an individual pitch page, is it possible for each added sample to have an option to choose a specific image from within a particular project?
For example, add a new image and select Sample 3.3 from Project 3, add another image and choose Sample 1.2 from Project 1.
Thanks for the help! This one has me a little stumped.
I was thinking so, too. This helps to confirm that.
It looks like I have some more homework to do to figure this one out.
Thanks so much for the help!
Actually, I believe what you want to do may be possible. I have run into a similar need.
In my case I have a custom post type and in that post the user can set the item as either active or inactive. When they select inactive they are then shown a select box where they can select an alternate item to use in its place. I could have used the Post Object or Relationship type field for this, however, this would allow them to select another item that was also inactive. I did not want to do this because it would just confuse them and make them do the work of selecting an active item.
Then I found this tutorial: Dynamically populate a select field’s choices
(sorry for the long link, for some reason the editor would not allow me to add the link the right way.)
Anyway, the tutorial shows you how to use an options field to populate a select box. However, with a little work I was able to change it to a query to get only the items that are marked as active and built my own select that way. I have found this useful several times with the current project I’m working on.
You might be able do the something similar but in your case you can create a query that gets a list of the projects and then a loop to pull the list of images in each project. Then your user could select from that. Unfortunately there might be more work because you would only be able to add text to the select field to choose from and I don’t think you can show the actual images in the select field so it may not be a perfect workaround.
You must be logged in to reply to this topic.
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!
🙋♂️ We are researching for our upcoming website redesign and would love to showcase some brands/agencies of popular or well known websites that use ACF.— Advanced Custom Fields (@wp_acf) October 11, 2019
If you have worked on, or know of any websites that would suit, please comment below.#WordPress
© 2019 Advanced Custom Fields. Subscribe