Home › Forums › Backend Issues (wp-admin) › Multi-select pulling images from repeater on options page
I’m wondering if this would be possible? To allow the client to upload images in a repeater to the Theme options page, then use a multi-select on a custom post type to show the selected images on the frontend.
Or is this overly ambitious?
Solved by comparing the select label to the label of the image and if they match, show.
Although this method involves manually creating a new label & value for the select that matches the name of the image in the repeater, when it would be better if we could just call the repeater object directly within the select.
I’m not sure if it will work using images.
But what you want to do is to dynamically populate the choices of the select field with values from the repeater on the options page.
This will require having some type of identifier field in the repeater. You cannot use the row number because rows can be reordered.
Hi John,
Thanks for answering. However I realised based on your answer my question wasn’t entirely clear. I’ll give a better explanation.
Say the options page (in admin) has a repeater called “safety certifications”, with a name/text field and an image field. The client uploads the different items into the repeater, then goes to a product (in admin still) and that’s where i want to have a select that’s populated by the repeater in options, so they can select the various certifications the product has, which will in turn show the symbols/images on the front end. There is no select visible on the frontend, just the images attached to the selected certifications.
As i mentioned, i actually have this working but ideally i wanted to delivery a handsfree solution that doesn’t involve the client having to mess with custom fields.
The answer is still the same. You would dynamically populate the choices of the select field from the repeater on the options page. See the link. On the front end you would get the values of the select fields and then use them to look up the values on the options page and show the needed rows.
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 use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.