Title: Calling plugin inside template
Last modified: August 30, 2016

---

# Calling plugin inside template

 *  Resolved [DPGrant](https://wordpress.org/support/users/dpgrant/)
 * (@dpgrant)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/calling-plugin-inside-template/)
 * I’d like to call gss inside a template so it can be displayed outside the_content.
   It would still be inside the loop. Can this be done? Thx.
 * [https://wordpress.org/plugins/gallery-slideshow/](https://wordpress.org/plugins/gallery-slideshow/)

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

 *  Plugin Author [jethin](https://wordpress.org/support/users/jethin/)
 * (@jethin)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/calling-plugin-inside-template/#post-6553781)
 * Yup, just do the gss shortcode manually. Be sure to include your image IDs and
   any other arguments/options for your slideshow:
 * `<?php echo do_shortcode('[gss ids="YourImageIDs"]'); ?>`
 *  Thread Starter [DPGrant](https://wordpress.org/support/users/dpgrant/)
 * (@dpgrant)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/calling-plugin-inside-template/#post-6553796)
 * Thanks for your response, but that’s not quite what I’m looking for. I want to
   be able to use the image ids from the _existing_ shortcode and not hard code 
   them into the template.
 * Here’s what I’m looking for. Consider the humble loop:
 *     ```
       if (have_posts()) :
          while (have_posts()) :
             the_post();
                {do_something}
                the_content();
                {do_something_else}
          endwhile;
       endif;
       ```
   
 * Your plugin processes the shortcode and inserts the slider markup inside the_content.
   But I would like to call the slider in the first do_something block, so I can
   display it _before_ the_content. Since that call would also be within the loop,
   I believe the image ids would be available.
 * Being able to directly call the function encapsulated in your plugin would make
   it much more flexible. What do you think?
 *  Plugin Author [jethin](https://wordpress.org/support/users/jethin/)
 * (@jethin)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/calling-plugin-inside-template/#post-6553812)
 * OK. I’d still recommend the same method mentioned above. The trick is to pass
   your image ids into the function. Offhand I’d recommend adding a ‘gss_ids’ custom
   field to your pages/posts and then passing them into the function:
 *     ```
       $gss_ids = get_post_meta($post->ID, 'gss_ids', true);
       if(!empty($gss_ids)){
       	echo do_shortcode('[gss ids="' . $gss_ids . '"]');
       }
       ```
   
 * You could do something similar with options if need be, but I’d recommend just
   using a default gss option set for simplicity.
 * Let us know if that works for you. Thanks.
 *  Plugin Author [jethin](https://wordpress.org/support/users/jethin/)
 * (@jethin)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/calling-plugin-inside-template/#post-6553842)
 * Marking topic as resolved.

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

The topic ‘Calling plugin inside template’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/gallery-slideshow.svg)
 * [Gallery Slideshow](https://wordpress.org/plugins/gallery-slideshow/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/gallery-slideshow/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/gallery-slideshow/)
 * [Active Topics](https://wordpress.org/support/plugin/gallery-slideshow/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/gallery-slideshow/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/gallery-slideshow/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [jethin](https://wordpress.org/support/users/jethin/)
 * Last activity: [10 years, 7 months ago](https://wordpress.org/support/topic/calling-plugin-inside-template/#post-6553842)
 * Status: resolved