Media attachment page – custom URI, and trying to display differing links, based on that URI
I’m trying to edit the “media attachment” template.
I have four image galleries, each one with a different URI.
I want the media template to reflect the gallery in a link in the page.
The media attachment page URI is /galleries/file-name-here.
I’m trying to make this URI reflect which gallery it is under.
For example, in the “Landscapes” gallery, the URI is /gallery/landscape/.
I want to make the images in that gallery have URIs that reflect that hierarchy. So, in the case of a landscape image, I want it to be /gallery/landscape/the-landscape-image.
How would I go about doing this?
And on the media attachment page that displays the image I want there to be a link that users can click to go back to the Landscape Gallery (link to /gallery/landscape/).
How would I do this to ensure it works correctly across all four galleries?