• blogdropper

    (@blogdropper)


    Hi I’m a newbi and need some help to pass variables to and from the shortcode exec php plugin.
    Please could someone give me the code snippets (both html page and the php) for the following example:
    Pass the variable david in the shortcode named hello-world.
    The php code then outputs: Hello david
    I’m using sessions if that makes a difference.
    Thanks for your help

    David

Viewing 5 replies - 1 through 5 (of 5 total)
  • M66B

    (@m66b)

    See the listing posts example here.

    M66B

    (@m66b)

    The second example is probably useful for you too.

    Thread Starter blogdropper

    (@blogdropper)

    Hi Marcel, Thanks very much for the links.
    Like I said I’m new to PHP and I need a little more help. I have the following html:

    <a href="https://mosheavni-art.com/?page_id=782"> <IMG src="https://mosheavni-art.com/wp-content/uploads/2011/12/arrow_left_trans_bg.png" alt="Go Back" style="margin-right: 10px;" /></a>

    which I’d like the shortcode exec php plugin to output. The 1st line output is: <a href="https://mosheavni-art.com/?page_id=<strong>782</strong>"> <IMG

    782 is the variable I want to pass to the php and I want it to output the html, please could you give me the php statement that will output the code including the variable.
    Thanks for your help

    David

    M66B

    (@m66b)

    Something like:

    extract(shortcode_atts(array('id' => '782'), $atts));
    
    echo '<a href="https://mosheavni-art.com/?page_id=' . $id . '"> <IMG src="https://mosheavni-art.com/wp-content/uploads/2011/12/arrow_left_trans_bg.png" alt="Go Back" style="margin-right: 10px;" /></a>';
    Thread Starter blogdropper

    (@blogdropper)

    Thanks Marcel for your help and patience, it’s now working as I wanted.
    This is not only an excellent plugin, but you also give great instant support.
    Thanks again
    David

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘how to pass parameters to shortcode exec php’ is closed to new replies.