add_shortcode to define global variable
-
I have my own template page which has some preset forms on ‘m. I would like to set the ‘to’-emailadres. This I can’t get working.
My thought: I create an add_shortcode so I can enter on my page: [set_email_to address=”funky@town.com”]
in my functions.php I have
$GLOBALS['this_emailadres'] = null; function gotya_email ( $atts, $content = null ) { extract(shortcode_atts(array("address" => "fallback@email.com"), $atts)); $GLOBALS['this_emailadres'] = $address; } add_shortcode('set_email_to address', 'gotya_email');So I would be able to get my $GLOBALS[‘this_emailadres’] to be the emailaddress to send it to. Sadly it isn’t working.
Any thoughts on how I could better do this?
(yes I know I can install a plugin __ don’t go there 🙂 )
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
The topic ‘add_shortcode to define global variable’ is closed to new replies.