List random posts

You can display a random post on your blog to make sure none of them are buried and forgotten. Just add the following where you want to show it.

Code Snippet:

<ul>
 	<li><h2>A random selection of my writing</h2>
    		<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>
	</li>
</ul> 

Posted in Posts