How to Display Random Posts in WordPress

August 6, 2018 comments 89 Reads

Want to add a list of random posts in WordPress? Having a list of random posts helps some of your older content gain exposure with your site’s visitors. In this video, we will show you two different methods to display random posts in WordPress.
WordPress has a default recent posts widget that lists your most recent posts in reverse chronological order which is good for your newer posts but your older posts don’t get as much exposure using that widget. For the first method to have random posts displayed you will want to install the Advanced Random Posts Widget plugin:

Advanced Random Posts Widget


With the plugin activated you should be able to go to Appearance, Widgets to add a new widget labeled ‘Random Posts’ that you can add where you like. The widget allows you to choose how many to display and what types of posts to show. There are other settings available to the plugin that you can modify that we have not covered in this video.
For the second method, we will show you how to manually add code to your theme’s functions.php file and you can find the code in our written article here:
https://www.wpbeginner.com/wp-tutorials/how-to-display-random-posts-in-wordpress/
You will want to copy the entire code from our article and paste it at the bottom of your theme’s functions.php. You can edit this file under Appearance, Editor, and on the right hand side, you would want to select theme functions. Save your changes and now you can add a shortcode where you like on your site to list random posts.
We list the shortcode in our written article as well that you can copy and paste in a post, page, or even in a text widget.
Text version of this tutorial
https://www.wpbeginner.com/wp-tutorials/how-to-display-random-posts-in-wordpress/
If you liked this video, then please Like and consider subscribing to our channel here for more WordPress videos.
https://www.youtube.com/subscription_center?add_user=wpbeginner
Check us out on Facebook
https://www.facebook.com/wpbeginner
Follow us on Twitter