Categories
Web Design

Multiple galleries on one page using WordPress

Ever wanted to add multiple image galleries to one page or post in WordPress? Here’s a simple way that doesn’t require any plugins.

If you upload some images using the WordPress image uploader and add the [ gallery ] shortcode to your post, you’ll see all the thumbnails together. However, there’s no way to insert something like a headline for certain thumbnails, unless you use the WordPress image uploader to manually insert code for the thumbnails. I find this problematic, as it inserts hard code into your post that won’t update if you do something like change the name of the image, or switch to a new theme.

To insert multiple galleries on one page, first start a new post and add whatever images you want in just that gallery. For example, I started a post called “Email Marketing” to show some of my email marketing designs. Then add more posts with more images until you’ve basically got a post with images for each gallery you want. When you Publish these pages, be sure to set the Visibility to Private. This will make these posts invisible to the public, yet you’ll be able to access the images elsewhere in WordPress.

After that, you’ll want to start a new page or post, which will display your multiple galleries. Ctrl or Command click the Add New button to open a new tab on your browser, because you’ll need to access the Posts to look up the post ID. Wherever you want a gallery, add [ gallery id=”X” ]. If you switch to the other tab and list your Posts, hover your mouse over the title of the particular post containing your image gallery, where you’re see something like “…post=123…” in the Status Bar. Put that number in the Gallery shortcode in order to pull up that post’s gallery, so in this case, we’d have [ gallery id=”123″ ]. After that, repeat the same steps until you have all the galleries you want on the page.

You can do similar tricks without having to worry about shortcodes with plugins, but I’m glad to have discovered this method because it allows me to use the WordPress image uploader and I can display a portfolio of different media. Previously I was having to write loops in my WordPress theme to get the images to display properly.

Any questions, please let me know.