Viewing 3 replies - 1 through 3 (of 3 total)
  • In order to use the gallery shortcode outside the loop, you need to specify the post id. Something like this:

    <?php echo do_shortcode('[gallery id="15"]'); ?>

    Please try it out.

    Thread Starter Pru

    (@pru)

    Hi, it does not work if I just put the <?php echo do_shortcode(‘[gallery id="15"]‘); ?> outside the loop. If I put [gallery] inside the post loop, then the lightbox works both in the loop and outside the loop.

    When I just use the code outside the loop without using [gallery] in the post, the three images in my gallery drop to a single column. When I click on them, it opens the image in the browser and shows nothing else. Sorry, I don’t have a live site or I’d give a link.

    I am using the Single Post Template Plugin from http://www.nathanrice.net/plugins/single-post-template/ so maybe that is causing a problem, but I can’t test without that plugin since I use it to display my other content.

    I have this issue also…
    Ideally I would like to call the gallery dynamic from within a loop for a specific category. However the code above and the following code pulled from wordpress codex on the gallery also doesn’t work

    <?php
       				 //$gallery_shortcode = '[gallery id="' . intval( $post->ID) . '"]';
    
       				 //print apply_filters( 'the_content', $gallery_shortcode );
    				 ?>

    The above didn’t work exactly, it pulled all the gallery images on the page in a column and once clicking on the images, it went to the image page versus lightbox.

    I also tried

    <?php
       				  $gallery_shortcode = '[gallery]';
    
       				 print apply_filters( 'the_content', $gallery_shortcode );
    				 ?>

    And that didn’t work either..
    Do you have a suggestion for pulling multiple galleries within the loop ?
    Thanks in advance,

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Lightbox Gallery] Does it work on php gallery code?’ is closed to new replies.