Create a Page that Displays Random Posts

Create a Page that Displays Random Posts

Hi WordPress has an inbuilt option to show the recent posts as an home page. but not the random posts
what if you want the same look on other pages ?
here we have solution for the problem.

How to Create a Page that Displays Random Posts Have you ever been to a site and saw this cool feature?
They have a link in their top navigation to something like Random! or Read Random Articles, or some other creative text.
When you click on that link, it takes you to a page that displays one random page.
Each time you refresh, you are delivered with a new post.

Well this trick is just for you then. You would need to follow the trick #1 in this article to create a custom page template.
And simply paste this code in there:

 

 

This is a simple WordPress Loop that is running a query to display random posts and the number 1 in there is telling WordPress to only show 1 post.
You can change that number, but most of the time people do it one post a time.
We have a Quick Reading Page on our site as well, so you can see this trick in action.