在最后一个典型查询中,我正在尝试排除前四个自定义查询中使用的帖子。。还没有找到任何能清楚解释如何做到这一点的东西。
我的前四个循环:
<?php
// Loop 1
$first_query = new WP_Query(\'category_name=funding&showposts=1\'); // select category
$ids = array();
while($first_query->have_posts()) : $first_query->the_post(); ?>
<?php the_title(); ?></br>
<?php endwhile;
// Loop 2
$second_query = new WP_Query(array(\'post__not_in\' => $ids,\'category_name\' => \'industry\',\'posts_per_page\' => 1)); // select category
while($second_query->have_posts()) : $second_query->the_post();
$ids[] = get_the_ID(); ?>
<?php the_title(); ?></br>
<?php endwhile;
// Loop 3
$third_query = new WP_Query(array(\'post__not_in\' => $ids,\'category_name\' => \'open-consultations\',\'posts_per_page\' => 1)); // select category
while($third_query->have_posts()) : $third_query->the_post();
$ids[] = get_the_ID(); ?>
<?php the_title(); ?></br>
<?php endwhile;
// Loop 4
$fourth_query = new WP_Query(array(\'post__not_in\' => $ids,\'category_name\' => \'policy\',\'posts_per_page\' => 1)); // select category
while($fourth_query->have_posts()) : $fourth_query->the_post();
$ids[] = get_the_ID(); ?>
<?php the_title(); ?>
<?php endwhile; ?>
我想从中删除重复帖子的典型WordPress查询:
<?php if ( have_posts() ) : ?>
<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<a href="<?php the_permalink(); ?>"><?php if ( has_post_thumbnail() ) { the_post_thumbnail( \'category-thumb\', array(\'class\' => \'alignleft\')); } ?></a>
<strong style="float:right;"><?php the_time(\'l, F jS, Y\') ?></strong>
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<?php the_excerpt(); ?>
<hr>
<?php endwhile; ?>
<?php wp_pagenavi(); ?> <!-- Pagination -->
<?php endif; ?>