<div class="sbox">
<h2>随机文章</h2>
<?
$args = array(
'numberposts' => 1,
'category' => 'wpstudy',
'orderby' => 'rand'
);
$rand_posts = get_posts( $args );
?>
<ul>
<? foreach ( $rand_posts as $post ) {
setup_postdata( $post ); ?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<? } wp_reset_postdata(); ?>
</ul>
</div>