Wordpres tutorial, how to get random posts in wordpress. Many times we need the random post from wordpress. Like for old tweet or if you want random posts. Like for old tweet or if you want to show random posts on home page. That is very easy wordpress provided simple method for this.
how to get random posts in wordpress
You just need to add the following query post code before loop.
<?php query_posts(array('orderby' => 'rand')); ?> //post data code will go here.
This way can easily show the random posts on home page.
Above is manual method for showing random posts in wordpress. If you want to show random posts using wordpress plugin than use smart widget post.
Great wordpress tip for showing the random posts on home page of wordpress. Cool Webmaster.
Very good post. Thanks. It’s just working!
please help me, where add this code in which file? :((
This is custom query code. You need add code in custom template or where you want to show random posts.