在php
我使用代码的文件上:
<div>
<?php
include('../blog/wp-blog-header.php');
define('WP_USE_THEMES', false);
$my_query = new WP_Query(array ('cat=11', 'orderby' => 'date', 'order' => 'DESC', 'posts_per_page' => '2' ));
while ($my_query->have_posts()) : $my_query->the_post();
?>
<h3><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h3>
<?php the_excerpt() ?>
<?php endwhile; ?>
<?php wp_reset_postdata();?>
</div>
<ul>
<?php
$my_query = new WP_Query(array ('cat=11', 'orderby' => 'date', 'order' => 'DESC', 'posts_per_page' => '10','offset' => 2 ) );
$i=0;
while ($my_query->have_posts()) : $my_query->the_post();
?>
<li <?php if($i==4) echo 'class="except"'; ?>>
<a href="<?php the_permalink() ?>" ><?php the_title(); ?></a>
</li>
<?php $i++;?>
<?php endwhile; ?>
<?php wp_reset_postdata();?>
</ul>
上面的代码不仅调用了id为11的category,还调用了其他category。为什么?