WordPress – Excluding more than one category in index.php

<?php while ( have_posts() ) : the_post(); ?>

<!– If the post is in the category we want to exclude, we simply pass to the next post. –>
<?php if ($postnum == 1 ) { ?>

// My content

<?php } ?>
<?php if (in_category(‘2’)) {$postnum = 0; continue; }
?>
<?php if (in_category(‘4’)) {$postnum = 0; continue; }
?>

Leave a Reply

Your email address will not be published. Required fields are marked *