How to select always unique next image from predefined array of images on each new post with post id incremented by 1
Let's say you have a limited array of images - let it be 100 elements - and you need to sequentially select the next image relative to the previous one for each new post.
This algorithm will help you.
So you have an array of images known as $images_array
For example your last article id will be a variable named $id. Variable $total_images — is an images array length. Then your next image index within $images_array array will be: $index = $id - $id/$total_images*$total_images;
This algorithm will help you.
So you have an array of images known as $images_array
For example your last article id will be a variable named $id. Variable $total_images — is an images array length. Then your next image index within $images_array array will be: $index = $id - $id/$total_images*$total_images;
This way you can get any of your image on $images_array[$index].