WordPress.org

Ready to get started?Download WordPress

Forums

If in parent category (1 post)

  1. motorzombi
    Member
    Posted 1 year ago #

    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>
    <div class="carta_catering">
    <p>texto</p>
    </div>
    <?php } ?>`

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

    Any ideas?

Topic Closed

This topic has been closed to new replies.

About this Topic