I am trying to access php variables in the footer which are declared in the header. For example, if I declare
$hello="Hello World!!"; in my header, when I try to make a call to $hello in the footer, it is null or empty.
Is there a way to access a php variable from one section which was declared in a prior section?
Thanks!!
--christopher
Use a function in your theme's functions.php to create these variables and then call the function in each template file as appropriate.
Thank you. Can you point me to any simple examples I can study to possibly get me further along?
One question, how do variables work in relation to include and require?
If I include or require a file, are the variables of the included file accessible in the functions.php?
Assuming they are global variables, yes.
I have been experimenting some, and have learned some things but still have questions.
I have a variable declared in my head called $user and another called $user_profile. How do I save these variables in a function that I can call in a different section/template file?
Thanks (and sorry for so many questions)