I am trying to create a gallery using a cpt. the gallery cpt has repeating fields for the images. i have created a gallery with a random order for the images. at the moment the images are not randomly order instead the cpts are the ones being randomly ordered.
Link to a page where the issue can be seen: hidden link
I wanted to have images to ordered randomly not just the cpts.
A View can query posts and return them in a random order, but if you are using wpv-for-each to iterate over repeating fields there is no way to do that any way other than sequentially.
So what you are asking may not be possible, but if you can tell me more about how you have set up your gallery I may be able to help.
if using wpv-for-each to iterate the repeating fields is not yet possible. Iis there another way we can iterate the repeating fields without using wpv-for-each?
Yes, well, it is as I stated above, that the queries for the posts can return results in random order, but not iterating over the custom fields with wpv-for-each.
The are two possible solutions.
One would be to write a custom shortcode that you use in place of wpv-for-each that effectively does the same thing—outputs each instance of the custom field for the current post—but in random order.
The alternative that wouldn't require any custom coding would be to add the images individually to a new post type which is a child post of the post types included in your current View.
Then, in place of having a wpv-for-each loop to iterate over the custom fields of the current post, you would insert a nested View which returned the child posts in random order (in the required format).