Title: New code for page templates?
Last modified: August 21, 2016

---

# New code for page templates?

 *  Resolved [Rethink](https://wordpress.org/support/users/rethink/)
 * (@rethink)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/new-code-for-page-templates/)
 * Upgraded to NextGen 2.0 and am getting a fatal error from the code that used 
   to display a slideshow in the page header. What’s the new syntax to use NextGen
   in my page template?
 * Thanks!
 * [http://wordpress.org/plugins/nextgen-gallery/](http://wordpress.org/plugins/nextgen-gallery/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Contributor [photocrati](https://wordpress.org/support/users/photocrati/)
 * (@photocrati)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/new-code-for-page-templates/#post-3979333)
 * [@rethink](https://wordpress.org/support/users/rethink/): Can you post a link,
   and can you tell us what method specifically you were using to display the slideshow
   in your header?
 * Thanks!
    Erick
 *  Thread Starter [Rethink](https://wordpress.org/support/users/rethink/)
 * (@rethink)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/new-code-for-page-templates/#post-3979402)
 * Here’s a portion–I had a whole list since I wanted a different slideshow on each
   page.
 *     ```
       <?php
       if( is_page('About St. Johns') ) echo nggShowSlideshow(2,400,156); ?>
       ```
   
 * This is no longer up live on the site, since I removed it after it threw the 
   error (the error was keeping the rest of the page from loading).
 * Thanks!
 *  Plugin Contributor [photocrati](https://wordpress.org/support/users/photocrati/)
 * (@photocrati)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/new-code-for-page-templates/#post-3979434)
 * [@rethink](https://wordpress.org/support/users/rethink/): I’m just thinking about
   this relative to another user who was trying to call nggShowGallery and it stopped
   working. I think we removed that function in 2.0.0. Our developer suggested they
   replace that with
 * $shortcode = “[ngg_images container_ids='{$gallery_id}’ display_type=’photocrati-
   nextgen_basic_thumbnails’]”;
 * echo do_shortcode($shortcode);
 * –
    Might try that (but replace “thumbnails” with “slideshow”. And let me know
   if that works.
 * Thanks.
 *  Thread Starter [Rethink](https://wordpress.org/support/users/rethink/)
 * (@rethink)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/new-code-for-page-templates/#post-3979501)
 * Yup, that works, with a couple small changes–I used “gallery_ids” instead of 
   container_ids. And then you add any additional filters to the shortcode, just
   like you would in the body of the page (making sure to use single quotes instead
   of double).
 * So, in my case, my code ended up looking like this:
 *     ```
       <?php echo $shortcode = "[ngg_images gallery_ids='1' display_type='photocrati-nextgen_basic_slideshow' gallery_width='400' gallery_height='156']";
       echo do_shortcode($shortcode); ?>
       ```
   
 * Works great. But, when I added the if statements, now I’m getting both the shortcode
   and the gallery showing up in the header. It’s the correct gallery and the shortcode
   associated with the page.
 * So my code is:
 *     ```
       <?php
       	   if( is_page('About St. Johns') )  $shortcode = "[ngg_images gallery_ids='2' display_type='photocrati-nextgen_basic_slideshow' gallery_width='400' gallery_height='156']";
       elseif( is_page('AGM') ) echo  $shortcode = "[ngg_images gallery_ids='3' display_type='photocrati-nextgen_basic_slideshow' gallery_width='400' gallery_height='156']";
       elseif( is_page('Artist Series') )  $shortcode = "[ngg_images gallery_ids='4' display_type='photocrati-nextgen_basic_slideshow' gallery_width='400' gallery_height='156']";
       elseif( is_page('What We Believe') ) echo  $shortcode = "[ngg_images gallery_ids='5' display_type='photocrati-nextgen_basic_slideshow' gallery_width='400' gallery_height='156']";
       elseif( is_page('Bulletins') ) echo  $shortcode = "[ngg_images gallery_ids='6' display_type='photocrati-nextgen_basic_slideshow' gallery_width='400' gallery_height='156']";
       elseif( is_page('Calendar') ) echo  $shortcode = "[ngg_images gallery_ids='7' display_type='photocrati-nextgen_basic_slideshow' gallery_width='400' gallery_height='156']";
       elseif( is_page('Choirs') ) echo  $shortcode = "[ngg_images gallery_ids='8' display_type='photocrati-nextgen_basic_slideshow' gallery_width='400' gallery_height='156']";
       elseif( is_page('Church Council') )  $shortcode = "[ngg_images gallery_ids='9' display_type='photocrati-nextgen_basic_slideshow' gallery_width='400' gallery_height='156']";
       elseif( is_page('Confirmation') ) echo  $shortcode = "[ngg_images gallery_ids='10' display_type='photocrati-nextgen_basic_slideshow' gallery_width='400' gallery_height='156']";
       echo do_shortcode($shortcode); ?>
       ```
   
 * (And so on, for another 30 pages)
 * The website: [http://st-johns-ucc.org/](http://st-johns-ucc.org/)
 * And you’ll see the photo galleries in the headers.
 * Thanks!
 *  Thread Starter [Rethink](https://wordpress.org/support/users/rethink/)
 * (@rethink)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/new-code-for-page-templates/#post-3979508)
 * Found the problem–there were some extra “echo”s in there that I missed when I
   was swapping in the new code. So the appropriate code is:
 *     ```
       <?php $shortcode = "[ngg_images gallery_ids='1' display_type='photocrati-nextgen_basic_slideshow' gallery_width='400' gallery_height='156']";
       echo do_shortcode($shortcode); ?>
       ```
   
 * Thanks for your help!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘New code for page templates?’ is closed to new replies.

 * ![](https://ps.w.org/nextgen-gallery/assets/icon-256x256.png?rev=2083961)
 * [Photo Gallery, Sliders, Proofing and Themes - NextGEN Gallery](https://wordpress.org/plugins/nextgen-gallery/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/nextgen-gallery/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/nextgen-gallery/)
 * [Active Topics](https://wordpress.org/support/plugin/nextgen-gallery/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/nextgen-gallery/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/nextgen-gallery/reviews/)

## Tags

 * [header](https://wordpress.org/support/topic-tag/header/)
 * [nextgen](https://wordpress.org/support/topic-tag/nextgen/)
 * [page template](https://wordpress.org/support/topic-tag/page-template/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * 5 replies
 * 2 participants
 * Last reply from: [Rethink](https://wordpress.org/support/users/rethink/)
 * Last activity: [12 years, 9 months ago](https://wordpress.org/support/topic/new-code-for-page-templates/#post-3979508)
 * Status: resolved