从循环中移除特定分类

Avatar of Chris Coyier
Chris Coyier
<?php query_posts('cat=-3'); ?>

<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
  <h3></h3>	
  <p><?php the_time('F jS, Y') ?></p>
  <?php the_content(); ?>
<?php endwhile; ?>

while循环内部的区域可以是任何内容,这只是一些示例性的循环内代码。诀窍在于第一行和cat=-3参数。在这种情况下,-3 是分类的 ID,您可以将其替换为希望从循环中移除的任何分类。您可以在这里使用逗号分隔的值来移除多个分类(例如 cat=-1,-2)。