I'm trying to get a value from a ShortCode into a variable for use it in my template file. How can i do that?
Here is my code :
In the post, the short code :
[reference_prix]1-214eddz[/reference_prix]
My plugin code :
$bl_reference_prix = "";
add_shortcode('reference_prix', 'get_blref_prix');
function get_blref_prix( $atts, $reference = null ) {
global $bl_reference_prix;
$bl_reference_prix = $reference;
}
But $bl_reference_prix is still empty.
I've try with $GLOBAL[] but i've the same issu.
What is the best practice for get a value write by the user in a wordpress post and display (or use it) in the template file?