Display Random Posts In WordPress

Here is a block of code which will display posts as randomly in WordPress.This is one of the simple loop to show Random Posts In WordPress.

WordPress Code for Random Posts

<?php
query_posts(array('orderby' => 'rand', 'showposts' => 1));
if (have_posts()) :
while (have_posts()) : the_post(); ?>
 
<h1><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h1>
 
<?php the_content(); ?>
 
<?php endwhile;
endif; ?>

Related posts:

Partner with Us

We are providing an exclusive partnership offer to individuals and companies who are interested in setting up their own web design & development company. For more information about how to partner with us, please contact us