• Hi there,

    I’ve been trying the following code out in a million combinations, but can’t seem to get it working. I was hoping someone could help me identify the problem.

    <?php if (in_category('mac') && in_category('pc')) {
    echo 'computer';
    } else {
    single_cat_title('','false');
    } ?>

    So the first half of this works – my html will display the word ‘computer’ when the post is in both the mac and pc categories. But the ‘else’ statement doesn’t work, it’s meant to display the category name when the first condition isn’t met, but instead it seems to display nothing at all.

    Any help is greatly appreciated.

    Cheers,
    Glen

  • The topic ‘Display category title in a conditional’ is closed to new replies.