Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

brianhre on "in_category condition not working"

$
0
0

Hello. I`m trying to display a label with specific text for products that belong to two categories (Green and Oolong). All other categories will display the same text. I am having trouble getting this to work correctly.

<?php if ( in_category('Green') ) { ?>

    <label><?php _e( 'Quantity - 150 G', 'yit' ) ?></label>

<?php } elseif ( in_category('Oolong') ) { ?>

    <label><?php _e( 'Quantity - 150 G', 'yit' ) ?></label>

<?php } else { ?>

<label><?php _e( 'Quantity', 'yit' ) ?></label>

<?php } ?>

Any help would be appreciated.


Viewing all articles
Browse latest Browse all 8245

Trending Articles