All attached images are stored in WP_POST table and have PARENT_POST which is only one.

So if I put some image in one gallery the image will belong to that gallery(post). If I add the same Image in another gallery(post) and open the image page, than all next and prev image links will be from the first gallery.

How Can I have 2 galleries and when I open the image page to fetch only the images which are in that gallery(post).

Thank You

  • How are next/previous links implemented in your theme? – Rarst Dec 28 '13 at 20:12
  • next_image_link() && previous_image_link – user43506 Dec 28 '13 at 22:44
  • The default theme twentyfourteen works the same way and has the same problem. – user43506 Dec 28 '13 at 22:49
  • Those functions are quite clearly coded with shared post parent in mind. Which pages precisely do you mean? Image's attachment page? If you left page with gallery it wouldn't know which gallery you want to cycle through... – Rarst Dec 28 '13 at 22:55
  • Those function are taking the parent post from the WP_POST. So I have 2 posts with different galleries. If i have 1 image which is the same for both galleries. When I open the image which will open IMAGE.PHP. There next and prev Image will be the one where the image was added first. I want somehow when I open the image from any gallery next and prev images to be the one from where the gallery was open. I don't know how I can do it. – user43506 Dec 28 '13 at 23:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.