How to show Random posts without using any Wordpress plugins
Displaying the “Random posts” in your blog is the best ways to drag the users/ viewers attentions and hence helps in optimizing the bounce rates of your website. There are many plugins which display the random posts like Random Posts Widget ,Advanced Random Post ,Random Posts ,AJAX Random Posts ,Random Posts from Category ,Randomizer ,Random Featured Post and several others. Apart from these plugins you can also use light custom code to get the random posts which work on simple MySQL RAND() function to sort the random post using parameter values.
Code for displaying random posts in wordpress template
<li>
<h2>Random thougths of my blog</h2>
<ul>
<?php
$rand_posts = get_posts('numberposts=5&orderby=rand');
foreach( $rand_posts as $post ) :
?>
<li><a href="<?php the_permalink(); ?>">
<?php the_title(); ?>
</a></li>
<?php endforeach; ?>
</ul>
</li>
</ul>
Note: You can use the above code anywhere in your wordpress templates. If you like this post then must go through the 101 List Of Awesome Wordpress Tips and Resources .
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackbackfrom your own site.
Subscribe to our FREE Rss FeedWhat's Hot
Similar Interesting Posts
- How to add featured content slider into wordpress blog
- How to hide a categories posts from wordpress RSS Feeds without using any plugin
- How to display Tag Clouds without using any Wordpress Plugins
- 101 List Of Awesome Wordpress Tips and Resources
- WhiteMag – Light weight simple wordpress theme
- Top 25 twitter tools for Wordpress
- How to use multi tabbed menu in wordpress
- Top 20 wordpress plugins that you can’t miss
- GetWIKI Plugin for Wordpress
- How to auto add excerpt in the wordpress blog home page
- How to hide a categories posts from Home page without using any plugin
- How to add poll in your blog
- Affiliate Marketing through Wordpress Tool
- How to redirect wordpress.com blog to self hosted domain
- Top 40 Featured WordPress Video Tutorials
Tutorials On








August 23rd, 2009 at 8:01 pm
How to show Random posts without using any #Wordpress plugins http://is.gd/2uWFp
August 23rd, 2009 at 8:01 pm
How to show Random posts without using any #Wordpress plugins http://is.gd/2uWFp
August 24th, 2009 at 8:23 pm
How to show Random posts without using any Wordpress plugins http://bit.ly/10yeHV
August 26th, 2009 at 9:55 pm
nice article man…. keep up the good work
Shekhar´s last blog ..Professional .NET 2.0 Generics |Get the book for free
August 28th, 2009 at 12:23 am
it’s very useful
December 9th, 2009 at 8:09 am
hey, nice code, just what I need, thank you
December 27th, 2009 at 7:08 pm
How to show Random posts without using any Wordpress plugins http://bit.ly/8boNHD
January 22nd, 2010 at 1:52 am
How to show Random posts without using any Wordpress plugins http://bit.ly/8boNHD #wordpress
January 22nd, 2010 at 2:38 am
How to show Random posts without using any Wordpress plugins http://bit.ly/8boNHD #wordpress
January 22nd, 2010 at 2:41 am
Nice quick tip – RT @pkruvczuk: How to show Random posts without using any Wordpress plugins http://bit.ly/8boNHD #wordpress
January 31st, 2010 at 9:18 am
wow only your code works on my blog thank you so much..
check here:
h++p://pspwallpaper.cz.cc/search/psp+wallpaper+cloud.html