PHP code to add native galleries to attachment pages
-
Hello, i am trying to develop a theme where there is a native gallery on the homepage. Visitors click an image and it opens to the images attachment page with a description of the image.
I would like to add the rest of the gallery thumbnails underneath so visitors can keep clicking more images in the gallery instead of the back button.
Right now I have the native gallery written into each image’s description with shortcode- but it’s incredibly cumbersome, and each image in the gallery must be specified directly, which is a nightmare if I wanna update the gallery with more photos, I would have to go back and add the photo to the gallery description of every other photo in the gallery.
“<div class=”descriptions”>
ELEPHANT IN THE ROOM
<br>
By: Jayes Caitlin
Date: 2017
Media: 9 color silkscreen
Size: 12×16″GLOWS IN THE DARK
$60
[wp_cart_button name=”ELEPHANT IN THE ROOM” price=”60.00″]
</br></br>
[gallery type="rectangular" columns="4" ids="2477,2478,2479,1939,1928,1906,1905,1893,1859,1340,1273,1271,1230,1216,1215,992,1718" orderby="rand"]
<br>
<br>
</br></br></div>”
I’m sure there is a better way to add the code the php attachment page, but I can’t figure out what bits of code to use and where to put it exactly. My theme does not have a php page for attachment pages.
I am using aav1
Take a look:
Thanks!
- The topic ‘PHP code to add native galleries to attachment pages’ is closed to new replies.