Support » Fixing WordPress » If in parent category

  • I have this structure

    Category > Subcategory > Post

    I´m trying to display some content if the user it´s on a specific category, or in it´s subcategory or post.

    I´m using this code but it only works if the user is in the category.php, not if the user it´s on a single.php that belongs to the that parent category:

    `<?php if(is_category(‘catering’)){?>
    <div class=”logo”>
    <img src=”<?php bloginfo(‘template_directory’) ?>/images/canal.png” />
    <div class=”carta_catering”>
    <?php } ?>`

    I tried with if(in_category) but it still didn´t show anything on single.php.

    Any ideas?

  • The topic ‘If in parent category’ is closed to new replies.