Hello,
I’m using a repeater to generate some text boxes (they have several sub-fields, for example title, subtitle, text, related link, etc). I want to then link each image in the media uploader to a unique text box and display both using a custom gallery code (the text box will appear this next to the image). I’m doing this to support more advanced cases than the media uploader description/caption/alt text could handle.
I got this working, but the problem is that the IDs that ACF generates for the different rows in a repeater are not unique, and always start from 0 depending on the set order. You can see how this is a problem, because if I reorder the rows at a later point, the associations will get all mixed up.
Is there any possible solution for this?
Thanks for your help.
I did more digging and I think I might have made this work in a different way, by adding an Image subfield for each row and thus creating the relationship in the repeater, instead of the other way around.
In the gallery code, I can the use get_field to get all the rows and for every images search for a row which has a linked image ID matching the current one.
I’d still be curious to know if it could also be done the other way around.
Hi @Tudor
To add in a row ID, you could ad a text or number sub field to the repeater and write some CSS / JS which hides the column, and sets the value to a unique string / number.
This means that each row will always have a unique ID
Thanks
E