WordPress display random posts
Following code will display a list of 5 posts selected randomly by using the MySQL RAND() function for the orderby parameter value:
<ul><li><h2>A random selection of our Posts</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>
random post to display a specific category as I do? gracias
you have to create one widget for that.