How do I designate more than one category in this Wordpress hack?
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')) co开发者_开发问答mments_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();
}
?>
精彩评论