Home | About | Help Center | Privacy Policy

Try Our "Facebook App"

August 23rd, 2009

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

<ul>
  <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 Feed

Hot in Social Media


10 Best Social Media Case Studies

10 Tips To Become Social Without Using Social Media

Top 10 Tips To Enhance Personal Branding

What's Hot

Similar Interesting Posts

Tutorials On

18 Responses to “How to show Random posts without using any Wordpress plugins”

  1. How to show Random posts without using any #Wordpress plugins http://is.gd/2uWFp

  2. How to show Random posts without using any #Wordpress plugins http://is.gd/2uWFp

  3. How to show Random posts without using any Wordpress plugins http://bit.ly/10yeHV

  4. nice article man…. keep up the good work
    Shekhar´s last blog ..Professional .NET 2.0 Generics |Get the book for free My ComLuv Profile

  5. hey, nice code, just what I need, thank you

  6. How to show Random posts without using any Wordpress plugins http://bit.ly/8boNHD

  7. How to show Random posts without using any Wordpress plugins http://bit.ly/8boNHD #wordpress

  8. How to show Random posts without using any Wordpress plugins http://bit.ly/8boNHD #wordpress

  9. Nice quick tip – RT @pkruvczuk: How to show Random posts without using any Wordpress plugins http://bit.ly/8boNHD #wordpress

  10. wow only your code works on my blog thank you so much..

    check here:

    h++p://pspwallpaper.cz.cc/search/psp+wallpaper+cloud.html

Trackbacks

  1. How to show Random posts without using any Wordpress plugins | Hot WP Themes
  2. 12 Best WordPress SEO Plugins | Benzing Technologies | Creative Web Design, Affordable Web Hosting, SEO, Social Media Marketing
  3. 12 Best WordPress SEO Plugins | Benzing Technologies
  4. Random post en wordpress sin plugin | Codigo Geek
  5. Post aleatorios en WordPress sin plugin
  6. Random post en wordpress sin plugin | WwW.Urbanicano.Net »
  7. Senza categoria | Trucchi e codici PHP per wordpress

Leave a Reply

CommentLuv Enabled

Additional comments powered by BackType

    Follow @honeytech On Twitter

    New Campaign To Bring Focus On Wikipedia Video http://bit.ly/bL0A20
  • Subscribe For Tips


  • Top Fans Of The Day

Hot Tags

Social media mobile Web design Firefox blogging tips google Linux ubuntu browser WordPress Plugin How to mistakes Internet Designs iphone open source free Windows Social