阅读这篇文章很重要Codex chapter 一直到最后,因为基本建议都在本标题之后\'Note for Multiple Posts in the First Category\';
重复、乏味的代码:
<?php $do_not_duplicate = array(); ?>
<?php $mosaics = new WP_Query(\'category_name=mosaics&posts_per_page=5\'); ?>
<?php while ($mosaics->have_posts()) : $mosaics->the_post(); ?>
<?php $do_not_duplicate[] = $post->ID; ?>
<?php echo get_the_content(); ?>
<?php endwhile; wp_reset_postdata(); ?>
<br />
<?php $mosaics = new WP_Query( array( \'category_name\' => \'mosaics\', \'posts_per_page\' => 4, \'post__not_in\' => $do_not_duplicate ) ); ?>
<?php while ($mosaics->have_posts()) : $mosaics->the_post(); ?>
<?php $do_not_duplicate[] = $post->ID; ?>
<?php echo get_the_content(); ?>
<?php endwhile; wp_reset_postdata(); ?>
<br />
<?php $mosaics = new WP_Query( array( \'category_name\' => \'mosaics\', \'posts_per_page\' => 3, \'post__not_in\' => $do_not_duplicate ) ); ?>
<?php while ($mosaics->have_posts()) : $mosaics->the_post(); ?>
<?php $do_not_duplicate[] = $post->ID; ?>
<?php echo get_the_content(); ?>
<?php endwhile; wp_reset_postdata(); ?>
<br />
<?php $mosaics = new WP_Query( array( \'category_name\' => \'mosaics\', \'posts_per_page\' => 2, \'post__not_in\' => $do_not_duplicate ) ); ?>
<?php while ($mosaics->have_posts()) : $mosaics->the_post(); ?>
<?php $do_not_duplicate[] = $post->ID; ?>
<?php echo get_the_content(); ?>
<?php endwhile; wp_reset_postdata(); ?>