Create a native WordPress gallery using any post type’s images
Did you know ever wanted to have a on a page a gallery of some post’s images? Or maybe on a post, a gallery of some other post type’s images.
Yeah, me too.
It so happens that you can, without any plugins and the such.
The [gallery] shortcode accepts an id parameter (among others) that allows you to pass the post’s ID number to get the images from. So, for example:
[gallery id="123"]
will create a gallery taking the attached images of the post that has ID 123. It doesn’t matter if post 123 is a post, page, or a custom post type. They are all the same to WordPress.
Gotta love WP :)
2 responses to “Create a native WordPress gallery using any post type’s images”
How can I give a name (of the gallery) parameter to the gallery short code?
This isn’t possible with the current implementation of the gallery shortcode. Only IDs are supported.