How to set a PHP variable when every page is loaded?
-
I have a website where there is a main site and then lots of subpages that live under a specific directory, /locations/.
What I need to do is load a different header, sidebar, and footer based on if the page being viewed is part of the main site or a subpage.
I’ve already got a function to figure this part out, but I need a way to set this variable before the page is loaded. I’ve tried to set a global variable using the various hooks, but nothing seems to work.
How can I create a variable and make it available in all of my templates? NOTE: I have to have the $post global available when the variable is created.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘How to set a PHP variable when every page is loaded?’ is closed to new replies.