Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor photocrati

    (@photocrati)

    @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

    (@rethink)

    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

    (@photocrati)

    @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

    (@rethink)

    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: https://st-johns-ucc.org/

    And you’ll see the photo galleries in the headers.

    Thanks!

    Thread Starter Rethink

    (@rethink)

    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.