blogdropper
Member
Posted 1 year ago #
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
See the listing posts example here.
The second example is probably useful for you too.
blogdropper
Member
Posted 1 year ago #
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="http://mosheavni-art.com/?page_id=782"> <IMG src="http://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="http://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
Something like:
extract(shortcode_atts(array('id' => '782'), $atts));
echo '<a href="http://mosheavni-art.com/?page_id=' . $id . '"> <IMG src="http://mosheavni-art.com/wp-content/uploads/2011/12/arrow_left_trans_bg.png" alt="Go Back" style="margin-right: 10px;" /></a>';
blogdropper
Member
Posted 1 year ago #
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