I have seen many questions from people about how to create photo galleries in WordPress. But often I see these questions answered by somebody recommending a plugin or something like that. You don’t really need plugins to create photo galleries. WordPress has a huge amount of gallery functionality built right in. You just need to make your theme smarter in order to take advantage of it.
Note: Matt has one of the neatest photo gallery implementations around, and he often gets questions about it. So I’m going to refer to it from time to time in this post. Maybe you’ll want to head over there and familiarize yourself with some of the look and features of it.
Understanding the Gallery Concept
One of the first things you need to know is how WordPress organizes Galleries. A gallery is really just a post with a bunch of images attached to it.
While editing a post or creating a new one, you have the option to upload images or other files. When you upload a file through the file Uploader, WordPress creates a post just for that file. This post has a post_type of “attachment”. Images in particular get some extra processing, and they show up in multiple sizes, you can insert them into the posts, etc. You probably already knew that. You probably have seen the gallery inserter, which just inserts the “gallery” shortcode into your post.
What you might not have known is that it’s doing more than you think. It’s not just resizing those images you’re uploading, but it’s pulling out metadata and other information about the image too. It’s grabbing alot of the EXIF data from the image and storing it as postmeta items for that attachment post. The post itself, being a post, gets its own URL, which is the post that it is attached to’s URL followed by the attachment posts title. Basically, an attachment post is sorta like a child of the parent post, which contains the gallery. So all a gallery really is is the sum of the attachments posts that are children of the gallery post itself.
- A Non-Violent Activist Dies in Texas (online article)
- Are Police Taking Sides in Protests? (online article)
- Artwork, Stories and Photojournalism
- Austrian Party with Nazi Imagery Wins Big (online article)
- Notes from the Obama Rally (Nov. 12, 2007)
- The Media as Theater of War
- Travel Journal
- A New Yorker in Belize
- Belize: Hol Chan Marine Reserve and Shark Ray Alley
- Belmar Beach after the Storm – 2009
- Christmas in New York (2005)
- Civilization in the Jungle: Mayan Lamanai Temple
- Fruit and Flowers in the Garden State
- Jones Beach Airshow
- Protest at the UN: No to dictatorship, yes to democracy in Iran
- San Francisco 2005
- Wintery Wall Street – 2009
- Zombies at the Jersey Shore – 2009
- Two Visits to a Fast-Changing Lebanon (online article)
- Wahhabism, Saudi Arabia, and Their Gift to Yale | Omer Aziz
- How to Get Away With Murder in Small-Town India nyti.ms/2vMNZoI 40 minutes ago
- Sign made with paper cups stuck into a fence instagram.com/p/BX_kFUpg2QM/ 1 hour ago
- Wonder Bar, where you can pour your own beer @ the world famous wonder bar instagram.com/p/BX_j0GFAO1E/ 1 hour ago
- Bruce in Casper instagram.com/p/BX_jnpKAkft/ 1 hour ago
- Space.com Remembers Bruno Gulotta, Friend and Colleague Killed in Barcelona Attack shar.es/1SgUoJ via @SPACEdotcom 1 day ago