How to get the next and previous image title from attachment or gallery?
You are using an associative array of $attach_id => $attach_obj and loop through it. While there are methods to get the next and previous elements in this array, I would prefer to rely on continuous index array to get these objects. First convert the array: $images = array_values($images); Now loop through using the contineous index: … Read more