Use a variable in a shortcode
-
It is for a wheather site, a Meteobridge uploads an php file with some $variable like: temperature, moisture, windspeed. This file with the $variable is included in page.php in WordPress. Now I will shortcode the data in the wordpress pages.
I will use an $variable who is outside the function. In the shortcode function.
This is what i will do:
function shortcodevariable( $atts ){ return 'echo $variable'; } add_shortcode('variable', 'shortcodevariable');I think we need an array but I dont now how, can somebody help?
Thank you very much.
The blog I need help with is: (visible only to logged in users)
-
Hey janwwebdesign,
Your website seems to use the self-hosted WordPress version.
We’re only able to help with the WordPres.com websites. Please submit your query to WordPress.org forums. https://wordpress.org/support/forums/
- The topic ‘Use a variable in a shortcode’ is closed to new replies.