For image galleries, I need a code that uses next/previous links to bring you to the next/previous image in that post and keeps the images in the correct order you chose while inserting them into the post. (Every major news site seems to have this feature.)
Currently, if you add <?php next_image_link( false, 'Next Image' ); ?>
and <?php previous_image_link( false, 'Previous Image' ); ?>
to your image.php or your attachment template in WordPress the links may bring you to a gallery in a different post if the image is used elsewhere.
To further illustrate this proble, take a look at this gallery. There are three images. If you click the penguin and start using prev/next links to scroll through them you’ll see additional images which should not be displayed!
This problem still has been solved. I had to use the media editor to attach the posts… too bad WP isn’t always doing this natively when the image is uploaded.
These functions will help:
With this you can implement a previous next setup as you wanted, and, you can show all the thumbnails in the gallery.
e.g.: