I’m working on a website, where clicking a colour swatch will change the colour of the image displayed.
Essentially I need to upload a series of images with a colour attached to each image. I figured I’d use the Image/Gallery field for my images and the Color Picker field to achieve something like this – would this work?
Does anyone have any suggestions how best to go about something like this?
You can create a field group containing your color pickers and use the location rules to attach the field to attachments.
Now when you upload / edit an image, you can select a color. Perhaps you may want this to be a select field instead of a color picker to simplify the possible values saved.
Hi @elliot, first and foremost I’d just like to once again, thank you for making the most badass WordPress plugin I’ve ever used – ACF never ceases to amaze me!
When you say create a field group, do you mean like this?
That’s still a pretty arduous process to get those items in there. I’m all for making things a tad easier on the backend.
Any suggestions are welcome.
Your screenshot shows a repeater field, this is different to a field group.
A field group is where you edited the repeater field, and added it to a post_type via location rules.
I think your current setup with the repeater field is fine as long as all you need to do is loop through the images and output the color in a simple manor.