Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author jethin

    (@jethin)

    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

    (@dpgrant)

    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

    (@jethin)

    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

    (@jethin)

    Marking topic as resolved.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Calling plugin inside template’ is closed to new replies.