我有一个带有多个 WP_query 循环的主页,我想防止特色帖子同时出现在其特定的类别循环中。我只希望它不再是特色帖子时出现在类别循环中。
这是我的特色循环:
<?php
$featuredPost = new WP_Query();
$featuredPost->query('showposts=1&category_name=featured');
while ($featuredPost->have_posts()) : $featuredPost->the_post();
stuff
<?php endwhile; ?>
这是我的类别循环:
<?php
$categoryPost = new WP_Query();
$categoryPost->query('showposts=3&category_name=news');
while ($categoryPost->have_posts()) : $categoryPost->the_post();
stuff
<?php endwhile; ?>
<br/>
<?php
$categoryPost = new WP_Query();
$categoryPost->query('showposts=3&category_name=sport');
while ($categoryPost->have_posts()) : $categoryPost->the_post();
stuff
<?php endwhile; ?>
<br/>
<?php
$categoryPost = new WP_Query();
$categoryPost->query('showposts=3&category_name=art');
while ($categoryPost->have_posts()) : $categoryPost->the_post();
stuff
<?php endwhile; ?>
任何帮助将非常感激。