有一种更简单的方法get_posts()
作用
<?php $args1 = array( \'posts_per_page\' => 6, \'offset\'=> 0, \'category\' => array(2,3,25,30));
$myposts1 = get_posts( $args1 );
foreach ( $myposts1 as $post ) : setup_postdata( $post ); ?>
<div class="each-post col-lg-aynk col-md-aynk col-sm-aynk col-xs-aynk">
<a href="<?php the_permalink(); ?>">
<h2><?php the_title(); ?></h2>
</a>
<a href="<?php the_permalink(); ?>">
<div class="news-story-img">
<?php if (class_exists(\'MultiPostThumbnails\')) : MultiPostThumbnails::the_post_thumbnail(get_post_type(), \'secondary-image\'); endif; ?>
<?php the_post_thumbnail( get_permalink() ); ?>
</div>
</a>
</div>
<?php endforeach;
wp_reset_postdata();?>