Support » Themes and Templates » Post with 2 or more categories and in_category doesn’t work

  • Today, one of the editors of the blog published an article with 2 categories (ID: 6 and 35).

    In the template of the blog, I used conditional tags and in category.php the current category in the menu doesn’t highlight of the 35, same if I enter blog.com/category/35
    He will highlight the category of ID 6, because the last post that he identifies is ID 6 and 35 and it only highlight smallest ID.

    In the single.php (view post ID: 6 and 35) occur the same problem:
    <?php if (in_category(35)) { echo “Cat. 35”; } else { echo “Other Cat”; } ?>
    And print: Other Cat.

    Is it possible to correct that?

    Thank you.

  • The topic ‘Post with 2 or more categories and in_category doesn’t work’ is closed to new replies.