It is very important to make your blog visitors to interact with your blog and to make them stay longer. The longer they spend time on your blog, the longer your contents get exposed. There are several ways to make this possible. One of the most easiest and simple way is to display random posts of your blog. Just display it under a post or in the sidebar or wherever you wish to, and it will do the rest by attracting your visitors to read more posts.
Before, it was required to use a separate plugin to this, but now you can display a list of random posts on your blog with the help of few lines of code. Just paste this code in the sidebar or edit the theme files and paste it wherever you want:
$rand_posts = get_posts('numberposts=5&orderby=rand');
foreach( $rand_posts as $post ) :
<li><a href="<?php the_permalink(); ?>">
<?php the_title(); ?>
<?php endforeach; ?>
In the above code, numberposts=5 will make 5 random posts to be displayed in the list. Increase the number from 5 to the number of posts that you wish to display in this list.
This will now eliminate the need of using a plugin to display random posts and hence increases the chances of your visitors to spend more time on your blog. There is yet another way to make your visitors to spend more time on your blog, and that is by displaying a list of Related Posts. This however requires a plugin to display the list of relevant posts. Here’s how you can display related posts on your blog.
Source: The above code is extracted from WordPress Codex.