As a blogger, you might want a visitor to stay longer on your site in order to get more page-views. Putting up random posts gives the viewers chance to read more of your content. When navigating your site, a viewer might stumble upon a blog post that might have an attractive title tag leading to the viewer reading it.
Displaying random posts in your blog is one way to reduce bounce rate on your blog. Bounce rate is the number (percentage) of visitors who navigate away from your site after viewing a page. Now do you understand what I mean by random posts is one way to reduce bounce rate on your blog? In this article, we are going to take a look at how we can display random posts in WordPress.
How to display random posts in WordPress
There are two ways to display random posts in WordPress, although one seems easy and the other will seem a little bit difficult but I will try my best to be specific.
1. Using a Plugin
This is the first and easier method. This method is recommended for most users.
- First of all, install and activate Random Posts Widget. For more information, see our post on how to install plugins on WordPress.
- Upon activation, go to Appearance>> Widgets.
- There will be a new widget title, “Random Posts” among the list of available widgets.
- Simply hold the widget and add it to a sidebar.
- Do not change anything in the settings, just save.
2. Using PHP function
- Simply copy and paste the code below in your theme’s functions.php file.
The code above, creates a function that displays 5 random posts. It also enables short-codes inside WordPress widgets that enables you to display random posts inside a text widget.
You might wonder why there isn’t a random post widget on this blog. As we all know, this blog uses WordPress platform and it is not common for “someone to teach what he does not practice”. The main reason why I’ve not started using this is because I’m still working on some of my posts. Enjoy!