I have a blog structured with several different php files (header, footer, main, etc.). I want to create a PHP file called adv.php that contains a var that needs to be retrieved in all the other PHP files. I would like to include the adv.php file ONLY in the header.php, and make sure that the var still works in footer.php, main.php, and so on.
I tried and even with global vars, this doesn't seem to work. How can I fix this? Again, I would like to only include the adv.php file once in header.php and not in every single php file.
EDIT
Here is a simplified version of the code with only relevant parts:
adv.php
<?php $ad300_top_right_index = "RTB"; ?>
header.php
<?php include_once('adv.php'); ?>
main.php
<?php if ( $ad300_top_right_index == "RTB" ) { ?>
show code here
<?php } else { ?>
show some other code here
<?php } ?>
About the inclusions: it's a Wordpress template, where the resulting page will include header.php and main.php, and header.php includes adv.php. Of course adv.php gets included before I try to use the var in main.php.