how to get random posts in wordpress

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.

how to get random posts in wordpress

4 Comments

Add a Comment

Your email address will not be published. Required fields are marked *