I’m used to using php variables set in included file being used in another included file if all are included in the same document. This doesn’t work in WordPress theme parts. It’s easy to overcome though… you just need to recall the variable first…

somewhere in functions.php

 $my_var = "xyz" 

Now i can do this somewhere in header.php

<?php global $myVar ;  ?>
<?php echo $myVar; ?>

Last updated on 5th September 2018