Need HELP writing a category classes if statement
-
Ok gang, trying this a different way and think I’m almost there but somewhere in this code is a problem that I can’t find… or maybe I’ve just been staring at it too long.
I’m classing posts based on category or category parent which are set from the theme admin. Should be pretty obvious what’s going on here, but please ask if you’ve got a question:
<?php // SET CLASSES FOR DIFFERENT POST TYPES PER CUSTOM OPTIONS // $photocat = get_option('woo_photography_category'); $quotecat = get_option('woo_quotation_category'); $quotecatID = get_cat_ID( $quotecat ); if (get_categories('child_of => $photocat', TRUE)) { $mycat = "photograph"; } elseif (get_categories('in_category => $quotecatID')) { $mycat = "quote"; } else { $mycat = "post"; } ?>I’d then just pull a ‘class=<?php $mycat ?>” wherever it was needed.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Need HELP writing a category classes if statement’ is closed to new replies.