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 trackback from your own site.
Similar Interesting Posts
- How to hide a categories posts from wordpress RSS Feeds without using any plugin
- How to add featured content slider into wordpress blog
- How to remove trackbacks/pingbacks from wordpress posts without disabling it from dashboard
- 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
- How to auto add excerpt in the wordpress blog home page
Tutorials On
- How to fix IE6 PNG Transparency issues in wordpress
- How to redirect wordpress.com blog to self hosted domain
- How to optimize website loading time and performance
- How to add featured content slider into wordpress blog
- How to upgrade / unlock your iPhone in 15 minutes
Designs
- 50 Inspiring Book Cover Designs
- 50 Inspirational Web Portfolios
- 50 examples of Creative Art Typography
- 10 Photoshop Tutorials
- 10 Flash Resources
- 10 Web Design Forums
- 10 HTML / CSS Resources
- 10 Places for a Web Designer to Make Money Online








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
March 26th, 2010 at 3:04 am
Hi! Yeah, like Indra said, only your code works! I tried 3 others and they don’t seem to work. Thanks!
April 9th, 2010 at 7:27 am
it shows the same post 5 times. not working for me.
May 2nd, 2010 at 10:49 pm
i have tried social media marketing for getting our new products to be known on the market. it seems to work well specially if the audience is targeted “
May 19th, 2010 at 10:41 am
i was a former employee and now i am making my best effort to start up a small business.*;.