Can you add an order to repeatable fields? #669
Replies: 1 comment
-
Thank you for the clear explanation. At this time ACM does not support reordering the repeatable fields like that. A workaround you might consider in the meantime is to set up your models a little differently, which will make it a bit easier to re-order things. It's not an ideal workaround, but it might work for your use case. If you create a model for the carousel and a model for the carousel images, you can use a relationship field using the "Many to Many" option to make it possible to connect the images to the carousels. What this enables is an easier way to sort the query results for the carousel image models, effectively making it possible to change the carousel image order. This approach requires an additional plugin, like Post Types Order, which enables you to manually sort the carousel image custom post type. With this idea, the Carousels model would look something like this: The Carousel Images model would look something like this (and other fields you might need): On the Add/Edit post screen for the Carousel, you would link the Carousel Images like this: Then with the Post Types Order plugin, you can reorder the Carousel Image posts to achieve the order you want. One downside to this approach is that, if you have images assigned to multiple carousels, it would affect the sort order of all the carousels. There may be other ways to achieve this. I thought of another workaround that requires manually editing the db entry where the array of image IDs is saved, but that's tricker and easier to make mistakes. If I come up with another idea I'll let you know. Let me know your thoughts and if you have any additional questions. |
Beta Was this translation helpful? Give feedback.
-
Hi,
First of all, thank you for reading. We're trying to create a carousel based off of a repeatable media field, we can't see any way to reorder them however which is becoming a common requirement. Have we missed a setting or is another plugin interfering, as was the case with the pagination not working for us on relationship fields?
It seems a fairly major requirement to have the ability to reorder repeatable fields so we're assuming we're just missing something.
Beta Was this translation helpful? Give feedback.
All reactions