WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Hide comments box on certain category posts (5 posts)

  1. adilomar
    Member
    Posted 4 years ago #

    hi guys,
    iam trying to hide the comments box on certain category, so the user cannot comment on the posts which fall in that category
    i tried
    '<?php if (is_category('x')) : ?>
    <?php else : ?>
    <?php comments_template(); ?>
    <?php endif; ?>'

    buts its not working, anyone got solution for this?

  2. esmi
    Forum Moderator
    Posted 4 years ago #

    Try using <?php if (in_category('x')) : ?>

  3. adilomar
    Member
    Posted 4 years ago #

    wow thanks man worked like a charm!

  4. ipunkbali
    Member
    Posted 4 years ago #

    I wanna do the same thing, hiding comment box on certain category.

    But I cant find this code to change
    '<?php if (is_category('x')) : ?>
    <?php else : ?>
    <?php comments_template(); ?>
    <?php endif; ?>'

    Where do I find it? thanks

  5. inovawebdesign
    Member
    Posted 4 years ago #

    You may have figured it out by now, but it's in the Single Post template (single.php) toward the bottom. Paste the above code in place of <?php comments_template(); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic