Hot damn! Our biggest ever sale is almost over. Ends Sunday. Save up to 50% now.

Adding extra gallery pages to Photography

By team on March 17, 2011

Update November 8, 2011 Extra gallery pages are now possible using the gallery shortcode. If you’re running Photography 1.4 or later, you do not need to make the changes in this tutorial – see your theme documentation for instructions on creating multiple gallery pages.

With the release of Photography 1.2 the Gallery post type now includes built-in support for categories. Why is this useful? By default Photography shows all your galleries on one “Gallery Page”. With category support you may now create new gallery pages that only show galleries associated with a specific category. Our newest forum moderator, Mike Fields, wrote up an awesome tutorial on how to do just that. Thanks Mike! Before you get started, be sure to read through this tutorial: Customizing your theme → Editing a template file.

  1. Create a new category and give it a name representative of the collection of galleries that you would like to create. I’ll be using “Nature Shots” as an example, but the name you use can be anything you like.
  2. Assign all galleries that you wish to appear on your custom page to this category.
  3. Now you will need to create a custom page template to display all galleries in this category on one page. Copy the file named gallery.php from the photography_pro theme folder into your PRO child theme folder. You will want to rename it as well. If the category you created has the title “Nature Shots”, I would suggest naming the template gallery-nature-shots.php. It’s a good practice to use only lowercase letters and the dash character (-) when naming files. Never use spaces.
  4. Next you will need to change the name of the page template you just created. The template name is located at the top of the file and looks like this:
    /*
    Template Name: Gallery
    */
    

    You will want to give it a name that is similar to the name of the category you created in the first step. If the category was “Nature Shots”, I would suggest something like this:

    /*
    Template Name: Nature Shots Gallery
    */
    

    It’s a good practice not to use any punctuation here. Just use letters and spaces for best results.

  5. Now you will need to adjust the query. The original query is located on line 8 and looks like this:
    <?php query_posts( 'post_type=gallery&orderby=menu_order&nopaging=true&order=ASC' ); ?>

    you will want to replace this line with the following code:

    <?php
    query_posts( array(
    'post_type'     => 'gallery',
    'orderby'       => 'menu_order',
    'nopaging'      => 'true',
    'order'         => 'ASC',
    'category_name' => 'Nature Shots'
    ) );
    ?>
    
  6. Save your changes and upload the new page template to your server (if it isn’t already there). If you’re confused about uploading a file be sure to watch the video tutorial on how to use an FTP client.
  7. Create a new page in WordPress by expanding the “Pages” tab in the admin menu and clicking the “Add New” link. Be sure to give the page a title similar to the category name. I used “Nature Shots”.
  8. On the right-hand side of the screen, you should see a meta box with the heading “Page Attributes”. You will want to select the page template we just created from the “Template” dropdown. If you do not see this box, you will want to click the “Screen Options” tab (located in the upper right of the screen) and make sure that the “Page Attributes” option is checked.
  9. Publish your page! Now add the new page to your menu via Appearance → Menus. When you visit the page you should see only the galleries that have been associated with the “Nature Shots” category.

Enjoyed this tutorial? Let us know in the comments. If you have any questions or problems please head over to the support forums and we’ll be happy to help you out.

Enjoy this post? Read more like it in Tutorials.

“My website is absolutely gorgeous, and the support service is literally unlike any other I’ve experienced, probably in my whole life, in any industry!”

Jacqueline Smith

“I’m blown away by the generous and effective support provided. Super accessible, laid back, and knowledgeable!”

Micah Davisyes
Discover our WordPress Page Builder Now

(Over 600 small businesses got started last week)