Title: post_id as a variable?
Last modified: August 24, 2016

---

# post_id as a variable?

 *  [pulpcovers](https://wordpress.org/support/users/pulpcovers/)
 * (@pulpcovers)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/post_id-as-a-variable/)
 * Is it possible to put some kind of variable in as the post_id so that it refers
   to whatever post the shortcode is in? I need to be able to drop a single code
   across many posts and have it always refer to the post where it is. Perhaps change
   the behavior of the default tribulant_slideshow shortcode to show attached images
   if there is no gallery associated with the post? Right now it just says “No slides
   are available” unless I hardcode the post_id
 * [https://wordpress.org/plugins/slideshow-gallery/](https://wordpress.org/plugins/slideshow-gallery/)

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

 *  [xavierve](https://wordpress.org/support/users/xavierve/)
 * (@xavierve)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/post_id-as-a-variable/#post-6135255)
 * Hi there, thanks for this great plugin… a very brillant idea for making things
   usefull
 * it would be great if I could add the PHP code into single.php in order to show
   slideshow of current post -if it has images-
    ` <?php // if (function_exists('
   slideshow')) { slideshow($output = true, $gallery_id = false, $post_id = false,
   $params = array()); } ?>
 * is it there a doc page for PHP ?
 * thanks in advance!
 *  [xavierve](https://wordpress.org/support/users/xavierve/)
 * (@xavierve)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/post_id-as-a-variable/#post-6135260)
 * Hi Pulpcovers,
    To authomatically get the slideshow of current page, if page 
   is single page or post, just go to single.php (it depends of your theme) and 
   ad the slideshow hardcode
 * <?php
    $pid = get_the_ID(); if (function_exists(‘slideshow’)) { slideshow(true,
   false, $pid, array()); } ?>
 * tell me if you got it working 🙂

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

The topic ‘post_id as a variable?’ is closed to new replies.

 * ![](https://ps.w.org/slideshow-gallery/assets/icon-256x256.png?rev=1187457)
 * [Slideshow Gallery LITE](https://wordpress.org/plugins/slideshow-gallery/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/slideshow-gallery/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/slideshow-gallery/)
 * [Active Topics](https://wordpress.org/support/plugin/slideshow-gallery/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/slideshow-gallery/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/slideshow-gallery/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [xavierve](https://wordpress.org/support/users/xavierve/)
 * Last activity: [11 years, 2 months ago](https://wordpress.org/support/topic/post_id-as-a-variable/#post-6135260)
 * Status: not resolved