WordPress(category页)获取随机文章的方法

<?php
// 获取随机文章
$args = array( 'numberposts' => 10, 'orderby' => 'rand', 'post_status' => 'publish' );
$rand_posts = get_posts( $args );
foreach( $rand_posts as $post ) : ?>
    <li><?php echo $usewp->get_views(); ?>次阅读<br/>
        <a href="<?php the_permalink();?>"><?php the_title();?></a>
    </li>
<?php endforeach; wp_reset_query();?>