Solution
Place the code bellow in functions.php file inside your theme’s folder.
function randomPosts($numPosts = 5){
query_posts(array('orderby' => 'rand', 'showposts' => $numPosts));
if (have_posts()) : while (have_posts()) : the_post();
?>
<ul>
<li><a title="Permanent Link to <?php the_title(); ?>" href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
</ul>
<?php
endwhile;
endif;
wp_reset_query();
}
Change the layout to fit your needs.
Calling randomPosts(); will show 5 random posts and if you want a different amount then call it like randomPosts(number);

fre, mar 12, 2010
Engelske guides, PHP/Mysql