KXXT
KXXT

Reputation: 271

Display comments only in specific categories

I am trying to enable comments only in specific categories. Ex// Events Category ID=17 Videos Category ID=15

I tried this code with only one category listed.

<?php if (!in_category('17')) comments_template(); ?>

But yet the comments disappear instead... I thought that code was to ONLY display comments if in a specific category? And when I add multiple category IDs like so,

<?php if (!in_category('17, 15')) comments_template(); ?> it stops working...

I'd like to have more than 1 category display comments... Not only one. But it seems the code above is only to REMOVE comments from that category...

What is the correct code?

EDIT// Not sure if this information if useful..but these are all sub-categories that I wish to display and not display comments on.

Upvotes: 0

Views: 1653

Answers (1)

Pankaj Khairnar
Pankaj Khairnar

Reputation: 3108

Try this :

<?php if (in_category('15') || in_category('17')) comments_template(); ?>

Upvotes: 1

Related Questions