Want to display Random Posts on your WordPress Blog get more Page views and Help your old Content to be viewed, you probably need Random Post widget or plugin to show it. But why you use some plugin for some Simple work which you can get done inside WordPress easily
Just paste the below code were ever you want to display Random Posts :
<ul> <?php $args = array( 'numberposts' => 5, 'orderby' => 'rand', 'post_status' => 'publish', 'offset' => 1); $rand_posts = get_posts( $args ); foreach( $rand_posts as $post ) : ?> <li><h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2><p><?php the_excerpt(); ?> </p></li> <?php endforeach; ?> </ul> |
Now you will see the Random Posts, for more customization visit get_posts
on WordPress Codex
trucos wordpress says
any way to add thumbnails?
Ritesh Sanap says
Yes we can add thumbnails to it, but need to customize the code, will update one with Thumbnail one shortly or you just refer to http://wpden.net/how-to-get-first-image/ just combine both codes and you will get the desired result