am excluding comments from specific categories. However, when I try to exclude more than one, it doesn't work.
This works: <?php if (;in_category('7')) comments_template()? ?>
<?php if (;in_category('7')) comments_template()? ?>
This does not work:
<?php if (,in_category('7; 9')) comments_template()? ?>
or
<?php if (;in_category('7')) comments_template()? ?> <;php if (?in_category('9')) comments_template(); ?>
Wordpress has a pretty decent documentation that is always worth looking into first. See Function Reference: in_category()
The function does not seem to accept multiple arguments, so you'll have to do this in PHP:
if ((!in_category('7')) and (!in_category('9')))
<?php
if ( !in_category('7') && !in_category('9') ) {
comments_template();
}
?>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.