<?php // 获取随机文章 $args = array( 'numberposts' => 10, 'orderby' => 'rand', 'post_status' => 'publish' ); $rand_posts = get_posts( $args ); foreach( $rand_posts as $post ) : ?> <li> <div class="xwz-title-box clearFloat"> <a href="<?php the_permalink();?>" class="floatLeft"><?php the_title()?></a> <span class="floatRight">(<?php echo $usewp->get_views();?> 次浏览)</span> </div> <div class="xwz-desc-box"> <!--获取摘要--> <?php echo get_the_excerpt(); ?> </div> </li> <?php endforeach; wp_reset_query();?>