Pass global variable to category.php?
-
Hi all,
I’m trying to set a global variable in header.php that is tested in single.php and category.php.
Below is the code I’m using. This works on single pages, but it does not work on category pages.
What am I missing?
this is in my header.php
if (in_category( array('cat1','cat2','cat3')) || is_category( array('cat1','cat2','cat3')) || is_page('MyPage')) { global $subnav; $subnav = "foo"; }
this is in both single.php and category.php
get_header(); if ($subnav == "foo") { include(something); }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Pass global variable to category.php?’ is closed to new replies.