WordPress.org

Ready to get started?Download WordPress

Forums

WordPress shortcode (3 posts)

  1. rize
    Member
    Posted 3 years ago #

    I'm using this plugin "Slideshow Gallery"
    it works but I want to put it outside the post (on my single.php) to be able to float: right it..

    This is the plugin's shortcode [slideshow post_id="#"]

    Here's what I'm trying to achieve

    <?php echo do_shortcode("[slideshow post_id="<?php the_ID(); ?> "]"); ?>

    But it's not working. anyone know how to do it?
    Note: I placed it inside the loop

  2. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    try to use string concatenation within the code; and use the wordpress function that return the value; and use single quotes to wrap the string, so you can have the double quotes in the code:

    example:

    <?php echo do_shortcode('[slideshow post_id="'.get_the_ID().'"]'); ?>

    (untested)

  3. rize
    Member
    Posted 3 years ago #

    Wow thanks it worked!

    I'll research more on concatenation.

Topic Closed

This topic has been closed to new replies.

About this Topic