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; ?>
原文
使用WordPress代码排除特定分类的文章调用,
这篇文章介绍了如何在WordPress中使用`query_posts`函数,通过设置`cat=-1`参数来避免显示ID为1的分类下的文章,展示了在循环中调用文章链接和标题的方法。
650

被折叠的 条评论
为什么被折叠?



