0

I've set a global variable in functions.php like so:

$cat_args = array('cat1', 'cat2', 'cat3');

and tried to use it in a template file:

global $cat_args;
if is_cat($args):
//do stuff
endif;

The conditional returned false. If I echo $cat_args I get an array. Is there an extra step to passing it to the conditional / is what I'm trying to do possible? Thanks!

2
  • You did not set a global, and your syntax is wrong on the first line of the second code block, and it is a duplicate of : wordpress.stackexchange.com/a/81584/21376
    – s_ha_dum
    Commented May 7, 2014 at 23:47
  • aside form the syntax error you pointed out, the code works.
    – psorensen
    Commented May 8, 2014 at 0:25

0

Browse other questions tagged or ask your own question.