Use the coupon code WORDPRESS and save 30% OFF! Buy Now

Create a native WordPress gallery using any post type’s images

Last Updated On
Create a native WordPress gallery using any post type’s images WordPress template

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”

  1. Ingvar Aandalen says:

    How can I give a name (of the gallery) parameter to the gallery short code?

    • Anastis Sourgoutsidis says:

      This isn’t possible with the current implementation of the gallery shortcode. Only IDs are supported.

Leave a Reply

Your email address will not be published. Required fields are marked *

Get access to all WordPress themes & plugins

24/7 Support Included. Join 115,000+ satisfied customers.

Pricing & Sign Up

30-day money-back guarantee. Not satisfied? Your money back, no questions asked.

Back to top