• I’m attempting to place a condition within the code of my second sidebar. If the first post on my index.php is in a specific category, then content in the sidebar should be relevant to that category. I managed to achieve this using a simple if statement but the tag that I’m checking, which is the_category_ID() also causes the category number to print out.

    <?php if (the_category_ID() == 26) { do this } ?>

    Well, the “do this” works, but the category ID is also displayed. Can I mask from showing up?

Viewing 2 replies - 1 through 2 (of 2 total)
  • fleeting

    (@twofiverthreetwo)

    Try the_category_ID(‘false’) and see if that doesn’t fix the problem.

    Thread Starter Jon Griffith

    (@arretx)

    Thanks. I have abandoned the_category_ID since it was deprecated and have implemented the proper syntax.

    Thanks for the solution though.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Preventing a tag from displaying…’ is closed to new replies.