Variables not working in get_header
-
In a theme I’m currently working on, before get_header() I’ve been putting a variable to change the stylesheet and title of the page (at the moment, $category). Inside header.php, to use $category, I have it set to echo $category at the stylesheet and title tags… except when it echos $category it doesn’t output anything. The variable is blank.
As an experiment, to make sure the variable wasn’t being completely wiped, I echoed the $category variable directly after get_header() and it worked fine. I also tried directly grabbing header.php with include() and it worked fine in that case too. It’s just not working at all for get_header(). Does anyone have a fix or way to resolve this without just including header.php manually?
- The topic ‘Variables not working in get_header’ is closed to new replies.