Wordpress php: get category name in the single.php

Discussion in 'WordPress' started by postcd, Dec 5, 2014.

  1. #1
    Hello,

    please anyone knows how i can setup following condition to properly match with Wordpress category name slug?

    <?php if ( is_category( 'category1') ): ?>
    category1
    <?php endif; ?>
    PHP:
    above code is in single.php (article/post page), i want to print an special text for around 5 categories (each categ. its own text. above is mentioned only one category condition, i know how to make multiple (here), but above mentioned DO NOT works to show the text..
     
    Last edited: Dec 5, 2014
    postcd, Dec 5, 2014 IP