How to display random blog post on WordPress

Add below code to your WordPress theme and it will display posts on random wise. You need to edit the category in below code according to your need.

 
	<?php 
		query_posts('showposts=10&cat=5&orderby=rand');
		while ( have_posts() ) : the_post(); 
	?>	
 
		<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>">
			<h2><?php the_title(); ?></h2>
		 </a>		
		<?php the_excerpt();?>
 
	<?php endwhile; ?>

Related posts:

HTML5 page structure

HTML5 offers more powerful structure comparing to older versions of Html. There are many new …


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