[resolved] Show Comment Count (span) only if in specific categories (3 posts)

  1. keysuuh
    Posted 3 years ago #

    I ended up with this line of code//
    <span class="comments"><a href="<?php comments_link(); ?>"><?php if (in_category('14') || in_category('15') || in_category('1')) comments_number( '0', '1', '%' ); ?><span class="link-spanner"></span></a></span>

    What I am aiming for is to remove the whole span if post is not in a specific category...
    But that code above only removes the actual number of comments...

  2. keesiemeijer
    Posted 3 years ago #

    Try it with this:

    <?php if (in_category('14') || in_category('15') || in_category('1')) : ?>
    <span class="comments"><a href="<?php comments_link(); ?>"><?php comments_number( '0', '1', '%' ); ?><span class="link-spanner"></span></a></span>
    <?php endif; ?>
  3. keysuuh
    Posted 3 years ago #

    Fabulous :) Thank you very much!

Topic Closed

This topic has been closed to new replies.

About this Topic