passing a variable to is_category array
-
This seems like it should be so simple. I want my archive pages to display different things if we’re in a certain group of categories. AND I want to be able to define these categories as part of wp_options. So, I have:
<?php $featuredcats = get_option(‘featuredcats’);
if (is_category(array($featuredcats))) { ?>do some stuff
<?php } else {?>
do some different stuff
<?php }?>
In my case, the value of $featuredcats is 4,5,6,7,8–when I echo it, I get: 4,5,6,7,8
But it’s not being accepted as an array. If $featuredcats is a single integer, it works fine. But when I try entering comma-separated integers, it doesn’t work. I’ve tried exploding/imploding it, i doesn’t make a difference. Surely is_category must be able to accept a variable?????
- The topic ‘passing a variable to is_category array’ is closed to new replies.