多試試:多試試-計算機技術與軟件
php
http://www.wordpress.la/display-random-posts-without-plugin.html
html
一般咱們能夠經過Random Pages Widget插件來實現隨機文章的顯示,不過若是不想涉及插件,下面的代碼也能夠調用出隨機文章哦。dom
<ul> <?php $rand_posts = get_posts('numberposts=5&orderby=rand'); foreach( $rand_posts as $post ) : ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endforeach; ?> </ul>