• Hi, I am using a plugin called: InPost Gallery. I have added the shortcode to a template file but the shortcode needs the post ID to find the images related to the page. Is it possible to get the post id added to a shortcode in a template file?

    This is what I have at the moment:

    <?php echo do_shortcode("[inpost_nivo slide_width='600px' slide_height='auto' thumb_width='75' thumb_height='75' post_id="28" skin='light' transition_effect='random' transition_speed='600' autoslide='5000' control_nav='1' control_nav_thumbs='1' direction_nav='1' direction_nav_hide='0' controlNavThumbs='0' random_start='0' pause_on_hover='1' show_description='1' box_rows='4' box_cols='8' slices='15' start_slide='0' id='' random='0' group='0' show_in_popup='0' album_cover='' album_cover_width='200' album_cover_height='200' popup_width='800' popup_max_height='600' popup_title='Gallery' type='nivo'][/inpost_nivo]"); ?>

    You can see the post_id is set to 28. This needs to change depending on the page being viewed.

    If this is possible it would be a great help to hear your suggestions.

    Many thanks,

    Matt

Viewing 1 replies (of 1 total)
  • Thread Starter futurewebs

    (@futurewebs)

    For anyone who has a similar issue this is the code which sorted it for me:

    <?php 
    
    // Display shortcode for current post:
    
    $sc = sprintf( '[inpost_nivo post_id="%d"]', get_the_ID() );
    
    echo do_shortcode( $sc ); 
    
    ?>
Viewing 1 replies (of 1 total)
  • The topic ‘Page ID within Shortcode’ is closed to new replies.