X

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> 

Comments  Leave a Reply

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!