Image gallery: make image.php open in popup window
-
For my image galleries I have created a custom image.php template. I want to make this image attachment page open in a pop-up window when I click on the gallery thumbnail.
I can create popups with jquery, but need to somehow add the necessary class, height, and width attributes to the WordPress-generated link that gets wrapped around each img tag on the gallery page.
In other words, the anchor code output to the browser on the gallery page is this:
<a href="https://example.com/image-attachment-page"><img></a>
and I want it to be:
<a href="https://example.com/image-attachment-page" class="popup" data-height="500" data-width="700"><img></a>
This will be a theme-specific change, so I’m guessing I need a little something in my functions.php file.
I greatly appreciate any help — thank you.
- The topic ‘Image gallery: make image.php open in popup window’ is closed to new replies.