WordPress排除调用某个分类下的文章

时间:2024-03-04 19:59:49

wordpress在调用分类下文章时,有时需要排除调用某个分类的文章,下面的这段代码,就可以轻松实现不调用特定ID的分类内容。

<?php

query_posts("showposts=10&cat=-1"); //cat=-1为排除ID为1的分类下文章

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

<li><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></li>

<?php endwhile; ?>

原文

https://www.zhanyes.com/code/6280.html